/* =============================================
   Sistema de Facturacion - Tema WHMCS Nexus
   ============================================= */

/* ---- CSS Variables ---- */
:root {
    --white: #fff;

    /* Neutral shades */
    --neutral-50: #fbf9fa;
    --neutral-100: #f4f5f7;
    --neutral-200: #e4e4e7;
    --neutral-300: #d0d5dd;
    --neutral-400: #9ca3af;
    --neutral-500: #6b7280;
    --neutral-600: #4b5563;
    --neutral-700: #374151;
    --neutral-800: #1f2937;
    --neutral-900: #111827;

    /* Primary */
    --primary: #111827;
    --primary-lifted: #1f2937;
    --primary-accented: #374151;

    /* Status colors */
    --success: #00a63e;
    --success-lifted: #008236;
    --info: #155dfc;
    --info-lifted: #1447e6;
    --notice: #7f22fe;
    --warning: #f54a00;
    --warning-lifted: #ca3500;
    --error: #e7000b;

    /* Text */
    --text: var(--neutral-900);
    --text-muted: var(--neutral-400);
    --text-lifted: var(--neutral-500);
    --text-accented: var(--neutral-600);
    --text-inverted: var(--white);

    /* Borders */
    --border-muted: var(--neutral-200);
    --border: var(--neutral-300);

    /* Backgrounds */
    --bg: var(--white);
    --bg-muted: var(--neutral-50);
    --bg-lifted: var(--neutral-100);
    --bg-accented: var(--neutral-200);
    --bg-inverted: var(--neutral-900);

    /* Accent colors for cards */
    --accent-blue: #155dfc;
    --accent-green: #00a63e;
    --accent-red: #e7000b;
    --accent-gold: #f59e0b;
    --accent-purple: #7f22fe;
    --accent-orange: #f54a00;
    --accent-teal: #00d5be;

    /* Rounding */
    --rounding-sm: 0.25rem;
    --rounding-md: 0.5rem;
    --rounding-lg: 0.75rem;

    /* Sidebar */
    --sidebar-width: 260px;
    --navbar-height: 60px;
}

/* ---- Base ---- */
body {
    background-color: var(--bg-lifted);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: var(--text);
    margin: 0;
}

a {
    color: var(--info);
    text-decoration: none;
}
a:hover {
    color: var(--info-lifted);
    text-decoration: underline;
}

/* ---- Top Navbar ---- */
.top-navbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--navbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--border-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1030;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.top-navbar .navbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.top-navbar .navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.top-navbar .navbar-user .dropdown-toggle {
    background: none;
    border: none;
    color: var(--text-accented);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--rounding-md);
    cursor: pointer;
    transition: background 0.15s;
}

.top-navbar .navbar-user .dropdown-toggle:hover {
    background: var(--bg-lifted);
}

.top-navbar .navbar-user .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--neutral-800);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-inverted);
    color: rgba(255,255,255,0.7);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-700) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--neutral-700);
    border-radius: 4px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    height: var(--navbar-height);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand-icon {
    width: 36px;
    height: 36px;
    background: var(--info);
    border-radius: var(--rounding-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand-logo {
    max-height: 36px;
    max-width: 36px;
    object-fit: contain;
    border-radius: var(--rounding-md);
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar-section {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
    margin-top: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    color: rgba(255,255,255,0.65);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}

.sidebar-link.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: var(--info);
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.75;
}

.sidebar-link.active i {
    opacity: 1;
}

.sidebar-link .badge {
    margin-left: auto;
    font-size: 0.65rem;
}

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    flex-shrink: 0;
}

/* ---- Main content wrapper ---- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    padding: 1.5rem;
    flex: 1;
}

/* ---- Cards ---- */
.card {
    border: 1px solid var(--border-muted);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    border-radius: var(--rounding-md);
    background: var(--white);
}

.card-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.85rem 1.25rem;
    color: var(--text);
}

.card-body {
    padding: 1.25rem;
}

/* Card accent borders */
.card-accent-blue { border-top: 3px solid var(--accent-blue); }
.card-accent-green { border-top: 3px solid var(--accent-green); }
.card-accent-red { border-top: 3px solid var(--accent-red); }
.card-accent-gold { border-top: 3px solid var(--accent-gold); }
.card-accent-purple { border-top: 3px solid var(--accent-purple); }
.card-accent-orange { border-top: 3px solid var(--accent-orange); }
.card-accent-teal { border-top: 3px solid var(--accent-teal); }

/* ---- Stats tiles (dashboard) ---- */
.stats-tile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease;
}

.stats-tile:hover {
    transform: translateY(-2px);
}

.stats-tile .tile-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--rounding-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stats-tile .tile-info {
    flex: 1;
    min-width: 0;
}

.stats-tile .tile-number {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.stats-tile .tile-label {
    font-size: 0.75rem;
    color: var(--text-lifted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 500;
}

/* Tile color themes */
.tile-blue .tile-icon { background: rgba(21,93,252,0.1); color: var(--accent-blue); }
.tile-green .tile-icon { background: rgba(0,166,62,0.1); color: var(--accent-green); }
.tile-gold .tile-icon { background: rgba(245,158,11,0.1); color: var(--accent-gold); }
.tile-red .tile-icon { background: rgba(231,0,11,0.1); color: var(--accent-red); }
.tile-purple .tile-icon { background: rgba(127,34,254,0.1); color: var(--accent-purple); }
.tile-teal .tile-icon { background: rgba(0,213,190,0.1); color: var(--accent-teal); }

/* ---- Tables ---- */
.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-lifted);
    border-bottom-width: 1px;
    font-weight: 600;
    background: var(--bg-muted);
    padding: 0.65rem 1rem;
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
    padding: 0.65rem 1rem;
    color: var(--text);
}

.table-hover tbody tr:hover {
    background-color: var(--bg-muted);
}

.table thead th {
    border-bottom: 1px solid var(--border-muted);
}

/* ---- Buttons ---- */
.btn-primary {
    background-color: var(--neutral-900);
    border-color: var(--neutral-900);
    color: var(--white);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--neutral-800);
    border-color: var(--neutral-800);
    color: var(--white);
}

.btn-outline-primary {
    color: var(--neutral-900);
    border-color: var(--neutral-900);
}
.btn-outline-primary:hover {
    background-color: var(--neutral-900);
    border-color: var(--neutral-900);
    color: var(--white);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--rounding-sm);
}

/* Info/Action button */
.btn-info {
    background-color: var(--info);
    border-color: var(--info);
    color: var(--white);
}
.btn-info:hover {
    background-color: var(--info-lifted);
    border-color: var(--info-lifted);
    color: var(--white);
}

/* ---- Badges ---- */
.badge {
    font-weight: 500;
    font-size: 0.7rem;
    padding: 0.35em 0.6em;
    border-radius: var(--rounding-sm);
}

.bg-primary {
    background-color: var(--neutral-900) !important;
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.page-header h1 i {
    color: var(--text-lifted);
    margin-right: 0.25rem;
}

/* ---- Breadcrumb ---- */
.breadcrumb-bar {
    background: var(--bg-accented);
    padding: 0.5rem 1.5rem;
    font-size: 0.85rem;
    margin: 0 -1.5rem 1.5rem;
    border-bottom: 1px solid var(--border-muted);
}

.breadcrumb-bar a {
    color: var(--text-lifted);
}

/* ---- Login page ---- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--neutral-900) 0%, var(--neutral-700) 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: var(--rounding-lg);
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    border: none;
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-card .login-logo {
    font-size: 2.5rem;
    color: var(--info);
}

.login-card .btn-primary {
    background: var(--neutral-900);
    border-color: var(--neutral-900);
}
.login-card .btn-primary:hover {
    background: var(--neutral-800);
    border-color: var(--neutral-800);
}

/* ---- Forms ---- */
.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-accented);
}

.form-control, .form-select {
    border-color: var(--border);
    border-radius: var(--rounding-sm);
    font-size: 0.875rem;
    color: var(--text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--info);
    box-shadow: 0 0 0 0.2rem rgba(21,93,252,0.12);
}

.input-group-text {
    background: var(--bg-lifted);
    border-color: var(--border);
    color: var(--text-lifted);
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* ---- Invoice view ---- */
.invoice-header {
    background: linear-gradient(135deg, var(--neutral-900) 0%, var(--neutral-700) 100%);
    color: #fff;
    padding: 2rem;
    border-radius: var(--rounding-md) var(--rounding-md) 0 0;
}

.invoice-status-bar {
    padding: 0.75rem 2rem;
    background-color: var(--bg-muted);
    border-bottom: 1px solid var(--border-muted);
}

/* ---- Due date colors ---- */
.due-overdue {
    color: var(--error);
    font-weight: 600;
}

.due-soon {
    color: var(--warning);
    font-weight: 600;
}

.due-ok {
    color: var(--success);
}

/* ---- Action buttons ---- */
.action-buttons .btn {
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

/* ---- Alert overrides ---- */
.alert {
    border-radius: var(--rounding-sm);
    font-size: 0.875rem;
}

/* ---- Footer ---- */
.main-footer {
    background: var(--bg-inverted);
    color: rgba(255,255,255,0.5);
    text-align: center;
    padding: 1.25rem 1.5rem;
    margin-top: auto;
    font-size: 0.8rem;
}

.main-footer a {
    color: rgba(255,255,255,0.65);
}

/* ---- Dropdown menus ---- */
.dropdown-menu {
    border: 1px solid var(--border-muted);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    border-radius: var(--rounding-md);
    padding: 0.35rem 0;
    font-size: 0.875rem;
}

.dropdown-item {
    padding: 0.45rem 1rem;
    color: var(--text);
}

.dropdown-item:hover {
    background: var(--bg-lifted);
    color: var(--text);
}

.dropdown-item i {
    margin-right: 0.5rem;
    color: var(--text-lifted);
    width: 18px;
    text-align: center;
}

/* ---- Sidebar toggle button (mobile) ---- */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-accented);
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    border-radius: var(--rounding-sm);
}

.sidebar-toggle:hover {
    background: var(--bg-lifted);
}

/* ---- Sidebar overlay (mobile) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ---- Responsive ---- */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .top-navbar {
        left: 0;
    }

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

    .sidebar-toggle {
        display: block;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-tile .tile-number {
        font-size: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .main-content {
        padding: 1rem;
    }

    .top-navbar {
        padding: 0 1rem;
    }

    .table-responsive {
        font-size: 0.8rem;
    }
}

/* ---- Print styles ---- */
@media print {
    .sidebar, .top-navbar, .no-print, .main-footer {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0;
        padding-top: 0;
    }

    body {
        background: #fff;
    }
}

/* ---- Scrollbar (global) ---- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}
