/* =============================================
   Smarter Webhosting - Billing System Styles
   ============================================= */

/* ─── CSS Variables ───────────────────────────── */
:root {
    --b-primary: #2563EB;
    --b-primary-dark: #1E40AF;
    --b-primary-light: #DBEAFE;
    --b-secondary: #10B981;
    --b-secondary-dark: #059669;
    --b-dark: #111827;
    --b-gray-900: #1F2937;
    --b-gray-700: #374151;
    --b-gray-500: #6B7280;
    --b-gray-400: #9CA3AF;
    --b-gray-300: #D1D5DB;
    --b-gray-200: #E5E7EB;
    --b-gray-100: #F3F4F6;
    --b-gray-50: #F9FAFB;
    --b-white: #FFFFFF;
    --b-danger: #EF4444;
    --b-danger-light: #FEE2E2;
    --b-warning: #F59E0B;
    --b-warning-light: #FEF3C7;
    --b-success: #10B981;
    --b-success-light: #D1FAE5;
    --b-info: #3B82F6;
    --b-info-light: #DBEAFE;
    --b-radius: 10px;
    --b-radius-sm: 6px;
    --b-radius-lg: 16px;
    --b-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --b-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --b-shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --b-transition: all 0.2s ease;
    --b-font: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sidebar-width: 260px;
}

/* ─── Reset & Base ────────────────────────────── */
.billing-wrap * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.billing-wrap {
    font-family: var(--b-font);
    background: var(--b-gray-50);
    color: var(--b-dark);
    min-height: 100vh;
    display: flex;
}

.billing-wrap a:not(.b-btn) {
    color: var(--b-primary);
    text-decoration: none;
    transition: var(--b-transition);
}

.billing-wrap a:not(.b-btn):hover {
    color: var(--b-primary-dark);
}

/* ─── Auth Pages (Login/Register) ─────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--b-primary-dark) 0%, var(--b-primary) 50%, #6366F1 100%);
    padding: 20px;
    font-family: var(--b-font);
}

.auth-card {
    background: var(--b-white);
    border-radius: var(--b-radius-lg);
    box-shadow: var(--b-shadow-lg);
    width: 100%;
    max-width: 460px;
    padding: 48px 40px;
    animation: authFadeIn 0.5s ease;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--b-primary-dark);
    margin-bottom: 4px;
}

.auth-logo h1 span {
    color: var(--b-primary);
    font-weight: 500;
}

.auth-logo p {
    color: var(--b-gray-500);
    font-size: 0.9rem;
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--b-dark);
    margin-bottom: 24px;
    text-align: center;
}

/* ─── Sidebar ─────────────────────────────────── */
.billing-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--b-gray-900) 0%, var(--b-dark) 100%);
    color: var(--b-white);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: var(--b-transition);
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--b-white);
    margin: 0;
}

.sidebar-logo h2 span {
    color: var(--b-primary-light);
    font-weight: 400;
}

.sidebar-logo small {
    display: block;
    color: var(--b-gray-400);
    font-size: 0.75rem;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar-nav-label {
    padding: 12px 20px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--b-gray-500);
}

.billing-sidebar .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--b-gray-400);
    font-size: 0.9rem;
    font-weight: 400;
    transition: var(--b-transition);
    border-left: 3px solid transparent;
}

.billing-sidebar .sidebar-nav a:hover {
    color: var(--b-white);
    background: rgba(255, 255, 255, 0.05);
}

.billing-sidebar .sidebar-nav a.active {
    color: var(--b-white);
    background: rgba(37, 99, 235, 0.15);
    border-left-color: var(--b-primary);
    font-weight: 500;
}

.sidebar-nav a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--b-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--b-white);
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-info strong {
    display: block;
    font-size: 0.85rem;
    color: var(--b-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info small {
    color: var(--b-gray-500);
    font-size: 0.75rem;
}

/* ─── Main Content ────────────────────────────── */
.billing-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.billing-topbar {
    background: var(--b-white);
    padding: 16px 32px;
    border-bottom: 1px solid var(--b-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.billing-topbar h1 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--b-dark);
    margin: 0;
}

.billing-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.billing-content {
    padding: 32px;
}

/* ─── Cards ───────────────────────────────────── */
.b-card {
    background: var(--b-white);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--b-gray-200);
    transition: var(--b-transition);
}

.b-card:hover {
    box-shadow: var(--b-shadow-md);
}

.b-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--b-gray-100);
}

.b-card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--b-dark);
    margin: 0;
}

/* ─── Stat Cards ──────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--b-white);
    border-radius: var(--b-radius);
    padding: 24px;
    box-shadow: var(--b-shadow);
    border: 1px solid var(--b-gray-200);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--b-transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--b-shadow-md);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--b-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-icon.blue {
    background: var(--b-info-light);
    color: var(--b-info);
}

.stat-icon.green {
    background: var(--b-success-light);
    color: var(--b-success);
}

.stat-icon.yellow {
    background: var(--b-warning-light);
    color: var(--b-warning);
}

.stat-icon.red {
    background: var(--b-danger-light);
    color: var(--b-danger);
}

.stat-info h4 {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--b-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 4px;
}

.stat-info .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--b-dark);
    line-height: 1;
}

/* ─── Tables ──────────────────────────────────── */
.b-table-wrap {
    overflow-x: auto;
}

.b-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.b-table th {
    background: var(--b-gray-50);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--b-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--b-gray-200);
    white-space: nowrap;
}

.b-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--b-gray-100);
    color: var(--b-gray-700);
    vertical-align: middle;
}

.b-table tbody tr {
    transition: var(--b-transition);
}

.b-table tbody tr:hover {
    background: var(--b-gray-50);
}

.b-table td strong {
    color: var(--b-dark);
}

/* ─── Badges ──────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: capitalize;
}

.badge-success {
    background: var(--b-success-light);
    color: var(--b-secondary-dark);
}

.badge-warning {
    background: var(--b-warning-light);
    color: #92400E;
}

.badge-danger {
    background: var(--b-danger-light);
    color: #991B1B;
}

.badge-info {
    background: var(--b-info-light);
    color: var(--b-primary-dark);
}

.badge-secondary {
    background: var(--b-gray-100);
    color: var(--b-gray-700);
}

/* ─── Buttons ─────────────────────────────────── */
.b-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--b-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--b-font);
    cursor: pointer;
    border: none;
    transition: var(--b-transition);
    text-decoration: none;
    line-height: 1.4;
}

.b-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--b-shadow-md);
}

.b-btn-primary {
    background: var(--b-primary);
    color: var(--b-white);
}

.b-btn-primary:hover {
    background: var(--b-primary-dark);
    color: var(--b-white);
}

.b-btn-success {
    background: var(--b-success);
    color: var(--b-white);
}

.b-btn-success:hover {
    background: var(--b-secondary-dark);
    color: var(--b-white);
}

.b-btn-danger {
    background: var(--b-danger);
    color: var(--b-white);
}

.b-btn-outline {
    background: transparent;
    color: var(--b-primary);
    border: 1px solid var(--b-gray-300);
}

.b-btn-outline:hover {
    background: var(--b-gray-50);
    border-color: var(--b-primary);
    color: var(--b-primary);
}

.b-btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.b-btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.b-btn-block {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* ─── Forms ───────────────────────────────────── */
.b-form-group {
    margin-bottom: 20px;
}

.b-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--b-gray-700);
    margin-bottom: 6px;
}

.b-form-group label .required {
    color: var(--b-danger);
}

.b-input,
.b-select,
.b-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--b-gray-300);
    border-radius: var(--b-radius-sm);
    font-size: 0.9rem;
    font-family: var(--b-font);
    color: var(--b-dark);
    background: var(--b-white);
    transition: var(--b-transition);
}

.b-input:focus,
.b-select:focus,
.b-textarea:focus {
    outline: none;
    border-color: var(--b-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.b-textarea {
    resize: vertical;
    min-height: 100px;
}

.b-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ─── Alerts ──────────────────────────────────── */
.b-alert {
    padding: 14px 18px;
    border-radius: var(--b-radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: alertSlide 0.3s ease;
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.b-alert-success {
    background: var(--b-success-light);
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.b-alert-danger {
    background: var(--b-danger-light);
    color: #991B1B;
    border: 1px solid #FECACA;
}

.b-alert-warning {
    background: var(--b-warning-light);
    color: #92400E;
    border: 1px solid #FDE68A;
}

.b-alert-info {
    background: var(--b-info-light);
    color: var(--b-primary-dark);
    border: 1px solid #93C5FD;
}

/* ─── Product/Order Cards ─────────────────────── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.product-card {
    background: var(--b-white);
    border-radius: var(--b-radius);
    box-shadow: var(--b-shadow);
    border: 1px solid var(--b-gray-200);
    overflow: hidden;
    transition: var(--b-transition);
}

.product-card:hover {
    box-shadow: var(--b-shadow-lg);
    transform: translateY(-4px);
}

.product-card-header {
    background: linear-gradient(135deg, var(--b-primary) 0%, var(--b-primary-dark) 100%);
    color: var(--b-white);
    padding: 24px;
    text-align: center;
}

.product-card-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--b-white);
}

.product-card-header .category-tag {
    font-size: 0.75rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.product-price {
    font-size: 2rem;
    font-weight: 700;
    margin: 12px 0 4px;
}

.product-price small {
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.8;
}

.product-card-body {
    padding: 24px;
}

.product-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

.product-features li {
    padding: 8px 0;
    color: var(--b-gray-700);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--b-gray-100);
}

.product-features li:last-child {
    border-bottom: none;
}

.product-features li i {
    color: var(--b-success);
    font-size: 0.85rem;
}

/* ─── Invoice Templates ───────────────────────── */
.invoice-view {
    max-width: 800px;
    margin: 0 auto;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--b-gray-200);
}

.invoice-header-left h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--b-dark);
    margin: 0 0 4px;
}

.invoice-header-right {
    text-align: right;
}

.invoice-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.invoice-meta-block h4 {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--b-gray-500);
    margin: 0 0 8px;
    letter-spacing: 0.5px;
}

.invoice-meta-block p {
    color: var(--b-gray-700);
    font-size: 0.9rem;
    margin: 2px 0;
}

.invoice-total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 0.9rem;
}

.invoice-total-row.total {
    background: var(--b-gray-50);
    font-weight: 700;
    font-size: 1.1rem;
    border-radius: var(--b-radius-sm);
    color: var(--b-dark);
}

/* ─── Service Detail Grid ─────────────────────── */
.service-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.service-detail-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--b-gray-100);
}

.service-detail-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--b-gray-500);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.service-detail-item span {
    font-size: 0.95rem;
    color: var(--b-dark);
    font-weight: 500;
}

/* ─── Empty State ─────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--b-gray-400);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--b-gray-500);
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.empty-state p {
    color: var(--b-gray-400);
    font-size: 0.9rem;
    margin: 0 0 20px;
}

/* ─── Quick Actions ───────────────────────────── */
.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* ─── Mobile Sidebar Toggle ───────────────────── */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--b-dark);
    cursor: pointer;
    padding: 4px 8px;
}

/* ─── Responsive ──────────────────────────────── */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .billing-sidebar {
        transform: translateX(-100%);
    }

    .billing-sidebar.open {
        transform: translateX(0);
    }

    .billing-main {
        margin-left: 0;
    }

    .billing-content {
        padding: 20px 16px;
    }

    .billing-topbar {
        padding: 12px 16px;
    }

    .sidebar-toggle {
        display: block;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .b-form-row {
        grid-template-columns: 1fr;
    }

    .invoice-header {
        flex-direction: column;
        gap: 16px;
    }

    .invoice-header-right {
        text-align: left;
    }

    .invoice-meta {
        grid-template-columns: 1fr;
    }

    .service-detail-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Print Styles (Invoices) ─────────────────── */
@media print {

    .billing-sidebar,
    .billing-topbar,
    .b-btn,
    .sidebar-toggle {
        display: none !important;
    }

    .billing-main {
        margin-left: 0 !important;
    }

    .b-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ─── Utility ─────────────────────────────────── */
.text-muted {
    color: var(--b-gray-500) !important;
}

.text-danger {
    color: var(--b-danger) !important;
}

.text-success {
    color: var(--b-success) !important;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 16px;
}

.align-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}