/* ============================================
   DASHBOARD – HOSTKART STYLE
   Complete – Phases 2.1, 2.2, 2.3
============================================ */

/* ---- 1. Reset & Setup ---- */
:root {
    --hk-red: #e74c3c;
    --hk-green: #009b4d;
    --hk-dark: #1a1a1a;
    --hk-bg: #ffffff;
    --hk-yellow: #FFCC00;
    --hk-ivory: #FAF5E9;
    --hk-text: #1F2937;
    --hk-muted: #6B7280;
    --hk-radius: 18px;
}

/* Remove WHMCS Default Padding/Sidebar feels */
.main-content, .hk-dashboard-container { 
    margin: 0 !important; 
    padding: 15px !important; 
    max-width: 100% !important;
}

/* ---- 2. Header & Fix Order Button ---- */
.hk-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 15px;
}

.hk-dashboard-greeting h1 { font-size: 22px; font-weight: 800; margin: 0; line-height: 1.2; }
.hk-dashboard-greeting p { margin: 5px 0 0; color: #666; font-size: 14px; }

.hk-btn-order {
    background: var(--hk-green);
    color: #fff !important;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,155,77,0.25);
}

@media (max-width: 480px) {
    .hk-dashboard-header { flex-direction: column; }
    .hk-btn-order { width: 100%; justify-content: center; padding: 14px; }
}

/* ---- 3. Red Promo Banner ---- */
.hk-promo-banner {
    background: linear-gradient(135deg, #d63031 0%, #e74c3c 100%);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.2);
}

.hk-promo-content { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; }
.old-price { text-decoration: line-through; opacity: 0.7; margin-left: 5px; }
.new-price { background: #fff; color: #d63031; padding: 2px 8px; border-radius: 5px; font-weight: 800; }

.hk-promo-btn {
    background: white;
    color: #d63031;
    padding: 6px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .hk-promo-banner { flex-direction: column; gap: 12px; text-align: center; }
}

/* ---- 4. Swipable Stats Carousel ---- */
.hk-stats-track {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 5px 5px 20px;
    scrollbar-width: none;
}

.hk-stats-track::-webkit-scrollbar { display: none; }

.hk-stat-card {
    min-width: calc(45% - 15px);
    scroll-snap-align: start;
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #eee;
    box-shadow: 0 5px 15px rgba(0,0,0,0.04);
}

@media (min-width: 992px) { .hk-stat-card { min-width: calc(25% - 15px); } }
@media (max-width: 480px) { .hk-stat-card { min-width: calc(85% - 15px); } }

.hk-stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.hk-stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.hk-stat-value { font-size: 24px; font-weight: 800; color: #333; }
.hk-stat-label { font-size: 13px; color: #888; font-weight: 600; }

.icon-green { background: #e6fcf0; color: #009b4d; }
.icon-blue { background: #eef2ff; color: #4f46e5; }
.icon-yellow { background: #fffbeb; color: #d97706; }
.icon-red { background: #fff1f2; color: #e11d48; }
.icon-purple { background: #ede9fe; color: #7c3aed; }

.hk-stat-bar { height: 5px; background: #f0f0f0; border-radius: 10px; margin-top: 12px; overflow: hidden; }
.hk-stat-bar .progress { height: 100%; background: currentColor; }

/* ---- 5. Dots Styling ---- */
.hk-slider-dots { display: flex; justify-content: center; gap: 6px; margin-top: -10px; }
.hk-dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd; transition: 0.3s; }
.hk-dot.active { width: 20px; border-radius: 10px; background: var(--hk-green); }

/* ---- 6. Quick Actions Grid ---- */
.hk-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 25px 0;
}

.hk-shortcuts a {
    background: #fff;
    border: 1px solid #f0f0f0;
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    text-decoration: none;
    color: #333;
    font-weight: 700;
    font-size: 14px;
    transition: 0.2s;
}

.hk-shortcuts a i { display: block; font-size: 20px; margin-bottom: 8px; color: var(--hk-green); }
.hk-shortcuts a:hover { border-color: var(--hk-green); transform: translateY(-3px); }

/* ---- 7. Brand Marquee ---- */
.hk-marquee { overflow: hidden; padding: 20px 0; border-top: 1px solid #eee; margin-top: 20px; }
.hk-marquee-track { display: flex; width: max-content; animation: marquee 20s linear infinite; }
.brand-item { padding: 0 30px; }
.brand-item img { height: 35px; filter: grayscale(1); opacity: 0.5; }

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ============================================
   PHASE 2.2 – PROFILE & SECURITY
============================================ */

/* ---- Profile/ Security Container ---- */
.hk-profile-container,
.hk-security-container {
    padding: 20px 0;
    max-width: 900px;
    margin: 0 auto;
}

/* ---- Header ---- */
.hk-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}
.hk-profile-greeting h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--hk-dark);
    margin: 0;
}
.hk-profile-greeting h1 i {
    color: var(--hk-green);
}
.hk-profile-greeting p {
    color: var(--hk-muted);
    font-size: 15px;
    margin: 4px 0 0;
}
.hk-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    background: #f1f4f9;
    color: var(--hk-text);
    transition: .3s;
}
.hk-btn-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

/* ---- Profile / Security Card ---- */
.hk-profile-card,
.hk-security-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,.05);
    border: 1px solid #eef2f7;
}

/* ---- Form Sections ---- */
.hk-form-section {
    margin-bottom: 30px;
}
.hk-form-section h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--hk-dark);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.hk-form-section h3 i {
    color: var(--hk-green);
}
.hk-section-desc {
    color: var(--hk-muted);
    font-size: 14px;
    margin: -10px 0 20px;
}

/* ---- Form Rows ---- */
.hk-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}
.hk-form-group {
    margin-bottom: 22px;
    position: relative;
}

/* ---- Floating Labels ---- */
.hk-form-group .form-control {
    height: 52px;
    border: 2px solid #e9edf4;
    border-radius: 14px;
    padding: 0 18px 0 46px;
    font-size: 15px;
    font-weight: 500;
    color: var(--hk-text);
    background: #fafbfc;
    transition: .25s ease;
    width: 100%;
}
.hk-form-group .form-control:focus {
    border-color: var(--hk-green);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0,155,77,0.12);
    outline: none;
}
.hk-form-group .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 18px;
    pointer-events: none;
    transition: .25s;
}
.hk-form-group .form-control:focus + .input-icon,
.hk-form-group .form-control:focus ~ .input-icon {
    color: var(--hk-green);
}
.hk-form-group.floating-label label {
    position: absolute;
    left: 46px;
    top: 15px;
    font-size: 14px;
    color: #a0aec0;
    pointer-events: none;
    transition: .2s ease;
    font-weight: 500;
    margin: 0;
}
.hk-form-group.floating-label input:focus ~ label,
.hk-form-group.floating-label input:not(:placeholder-shown) ~ label,
.hk-form-group.floating-label select:focus ~ label,
.hk-form-group.floating-label select:not([value=""]) ~ label {
    top: 6px;
    font-size: 11px;
    color: var(--hk-green);
    font-weight: 600;
}
.hk-form-group.floating-label input::placeholder {
    color: transparent;
}

/* ---- Password Toggle ---- */
.hk-form-group .password-toggle-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 18px;
    cursor: pointer;
    z-index: 2;
}
.hk-form-group .password-toggle-btn:hover {
    color: var(--hk-green);
}

/* ---- Password Strength ---- */
.hk-password-strength {
    margin: 10px 0 20px;
}
.hk-password-strength .progress {
    height: 6px;
    border-radius: 10px;
    background: #e9edf4;
    overflow: hidden;
}
.hk-password-strength .progress-bar {
    height: 100%;
    transition: width 0.3s ease;
}
.hk-strength-text {
    font-size: 13px;
    color: var(--hk-muted);
    margin: 6px 0 0;
}
.hk-strength-text span {
    font-weight: 600;
}

/* ---- 2FA Status ---- */
.hk-2fa-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 12px;
}
.hk-2fa-badge {
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
}
.hk-2fa-enabled {
    background: #dcfce7;
    color: #166534;
}
.hk-2fa-disabled {
    background: #fee2e2;
    color: #991b1b;
}

/* ---- Form Actions ---- */
.hk-form-actions {
    margin-top: 20px;
}
.hk-btn-lg {
    padding: 14px 40px;
    font-size: 16px;
    border-radius: 14px;
}

/* ---- Alerts ---- */
.hk-alert {
    padding: 14px 18px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 20px;
}
.hk-alert-danger {
    background: #fee2e2;
    color: #991b1b;
}
.hk-alert-success {
    background: #dcfce7;
    color: #166534;
}

/* ============================================
   PHASE 2.3 – BILLING & INVOICES
============================================ */

/* ---- Billing Container ---- */
.hk-billing-container,
.hk-invoice-container {
    padding: 20px 0;
    max-width: 1200px;
    margin: 0 auto;
}

/* ---- Stats Grid (reusable) ---- */
.hk-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* ---- Credit Alert ---- */
.hk-credit-alert {
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 14px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.hk-credit-alert i { color: #d97706; font-size: 20px; }
.hk-credit-alert a { font-weight: 600; color: var(--hk-green); }

/* ---- Invoice List (Hostinger style) ---- */
.hk-invoice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.hk-invoice-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px 20px;
    border-left: 5px solid #d1d5db;
    box-shadow: 0 4px 12px rgba(0,0,0,.04);
    transition: .2s;
}
.hk-invoice-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.hk-invoice-unpaid { border-left-color: #f59e0b; }
.hk-invoice-overdue { border-left-color: #ef4444; }
.hk-invoice-paid { border-left-color: #22c55e; }
.hk-invoice-cancelled { border-left-color: #9ca3af; }

.hk-invoice-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.hk-invoice-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.hk-invoice-number {
    font-weight: 700;
    font-size: 16px;
    color: var(--hk-dark);
}
.hk-invoice-date {
    font-size: 14px;
    color: var(--hk-muted);
}
.hk-invoice-total {
    font-weight: 700;
    font-size: 16px;
    color: var(--hk-dark);
}
.hk-invoice-actions {
    display: flex;
    gap: 8px;
}
.hk-btn-sm {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: .2s;
}
.hk-btn-primary {
    background: var(--hk-green);
    color: #fff;
}
.hk-btn-primary:hover {
    background: #007a3e;
    color: #fff;
    transform: translateY(-2px);
}
.hk-btn-outline {
    background: #f1f4f9;
    color: var(--hk-text);
}
.hk-btn-outline:hover {
    background: #e2e8f0;
}
.hk-btn-danger {
    background: #fee2e2;
    color: #dc2626;
}
.hk-btn-danger:hover {
    background: #fecaca;
}

/* ---- Payment Methods ---- */
.hk-payment-methods {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.hk-payment-card {
    background: #fff;
    border-radius: 16px;
    padding: 16px 20px;
    border: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: .2s;
}
.hk-payment-card:hover {
    border-color: var(--hk-green);
}
.hk-payment-icon {
    font-size: 28px;
    color: var(--hk-green);
}
.hk-payment-info {
    flex: 1;
}
.hk-payment-name {
    font-weight: 600;
    display: block;
}
.hk-payment-details {
    font-size: 14px;
    color: var(--hk-muted);
}

/* ---- Single Invoice View ---- */
.hk-invoice-view-card {
    background: #fff;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,.05);
    border: 1px solid #eef2f7;
}
.hk-invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid #eef2f7;
    margin-bottom: 20px;
}
.hk-invoice-status {
    font-size: 14px;
}
.hk-invoice-date, .hk-invoice-due {
    font-size: 14px;
    color: var(--hk-muted);
    margin-left: 12px;
}
.hk-invoice-address {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}
.hk-invoice-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.hk-invoice-table th {
    text-align: left;
    padding: 10px 0;
    border-bottom: 2px solid #eef2f7;
    font-weight: 600;
}
.hk-invoice-table td {
    padding: 10px 0;
    border-bottom: 1px solid #f1f4f9;
}
.hk-invoice-table tfoot td {
    border-bottom: none;
    padding: 6px 0;
}
.hk-invoice-total-row td {
    border-top: 2px solid #eef2f7;
    padding-top: 12px;
}
.hk-btn-lg {
    padding: 14px 40px;
    font-size: 16px;
    border-radius: 14px;
}

/* ---- Empty States ---- */
.hk-empty-state-card {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 24px;
    padding: 48px 32px;
    text-align: center;
    border: 2px dashed var(--hk-green);
}
.hk-empty-icon {
    font-size: 52px;
    color: var(--hk-green);
    margin-bottom: 16px;
}
.hk-empty-state-card h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--hk-dark);
    margin-bottom: 12px;
}
.hk-empty-state-card p {
    color: var(--hk-muted);
    font-size: 16px;
    max-width: 500px;
    margin: 0 auto 20px;
}

/* ---- Section Title (reusable) ---- */
.hk-section-title {
    margin: 30px 0 16px;
}
.hk-section-title h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--hk-dark);
    margin: 0;
}
.hk-section-title p {
    color: var(--hk-muted);
    font-size: 14px;
    margin: 4px 0 0;
}

.hk-view-all {
    color: var(--hk-green);
    font-weight: 600;
    text-decoration: none;
}
.hk-view-all:hover {
    text-decoration: underline;
}

/* ---- Billing Stats Grid Override ---- */
.hk-stats-grid .hk-stat-card {
    background: #fff;
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,.05);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid #eef2f7;
    transition: .3s;
}
.hk-stats-grid .hk-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0,0,0,.08);
}

/* ============================================
   RESPONSIVE FIXES
============================================ */

@media (max-width: 992px) {
    .hk-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .hk-profile-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .hk-profile-greeting h1 {
        font-size: 22px;
    }
    .hk-profile-card,
    .hk-security-card {
        padding: 24px 16px;
    }
    .hk-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .hk-form-group .form-control {
        height: 48px;
        font-size: 14px;
    }
    .hk-2fa-status {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .hk-invoice-row {
        flex-direction: column;
        align-items: stretch;
    }
    .hk-invoice-actions {
        justify-content: flex-start;
    }
    .hk-invoice-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .hk-invoice-address {
        flex-direction: column;
        gap: 10px;
    }
    .hk-btn-lg {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .hk-stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .hk-stats-grid .hk-stat-card {
        padding: 14px;
    }
    .hk-stat-content .hk-stat-number {
        font-size: 20px;
    }
    .hk-invoice-card {
        padding: 12px 16px;
    }
    .hk-invoice-info {
        gap: 8px;
    }
    .hk-invoice-number {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .hk-btn-secondary {
        justify-content: center;
    }
    .hk-form-actions .hk-btn-primary {
        width: 100%;
        justify-content: center;
    }
    .hk-stats-grid {
        grid-template-columns: 1fr;
    }
    .hk-payment-card {
        flex-direction: column;
        text-align: center;
    }
}