/* ==========================================================================
   Bill-o-Bill SuperAdmin Design System
   Brand: Deep Indigo (#13005A), AI Green (#03C988), Soft Mint (#E6FFF4)
   Typography: Manrope (Headings), Inter (UI & Data)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    --primary-indigo: #13005A;
    --primary-indigo-dark: #0c0038;
    --primary-indigo-light: #1f087d;
    --accent-green: #03C988;
    --accent-green-hover: #02b076;
    --accent-green-light: #e6fff4;
    --tint-indigo: #E9E6F5;
    --text-charcoal: #2B2B2B;
    --text-muted: #8E8E8E;
    --text-light: #f8fafc;
    --bg-surface: #ffffff;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --danger-red: #ef4444;
    --danger-bg: #fef2f2;
    --warning-yellow: #f59e0b;
    --warning-bg: #fffbeb;
    --info-blue: #3b82f6;
    --info-bg: #eff6ff;

    --font-heading: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(19, 0, 90, 0.06), 0 2px 4px -2px rgba(19, 0, 90, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(19, 0, 90, 0.08), 0 4px 6px -4px rgba(19, 0, 90, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(19, 0, 90, 0.1), 0 8px 10px -6px rgba(19, 0, 90, 0.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-charcoal);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--primary-indigo);
    letter-spacing: -0.02em;
}

a {
    color: var(--primary-indigo);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-green);
}

/* ==========================================================================
   Layout Structure
   ========================================================================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
    width: 260px;
    background: var(--primary-indigo);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
}

.logo-badge {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-green), #00a86b);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    color: var(--primary-indigo);
    box-shadow: 0 0 15px rgba(3, 201, 136, 0.4);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-subtitle {
    font-size: 10px;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

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

.nav-category {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    padding: 16px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    color: rgba(255, 255, 255, 0.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: #fff;
    background: rgba(3, 201, 136, 0.15);
    font-weight: 600;
    border-left: 3px solid var(--accent-green);
}

.nav-link svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    flex-shrink: 0;
}

.nav-link.active svg {
    stroke: var(--accent-green);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-snippet {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
}

.avatar-initials {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary-indigo-light);
    color: var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    border: 1px solid rgba(3, 201, 136, 0.3);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role-badge {
    font-size: 10px;
    color: var(--accent-green);
    font-weight: 600;
}

/* Main Content Area */
.app-main {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: 70px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-indigo);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.badge-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
}

.badge-green {
    background: var(--accent-green-light);
    color: #027a48;
}

.badge-red {
    background: var(--danger-bg);
    color: var(--danger-red);
}

.badge-yellow {
    background: var(--warning-bg);
    color: #b45309;
}

.badge-indigo {
    background: var(--tint-indigo);
    color: var(--primary-indigo);
}

.content-container {
    flex: 1;
    padding: 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Bento Grid & Cards
   ========================================================================== */

.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-6 { grid-column: span 6; }
.col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }

.bento-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

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

.kpi-card {
    position: relative;
    overflow: hidden;
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.kpi-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon-indigo {
    background: var(--tint-indigo);
    color: var(--primary-indigo);
}

.kpi-icon-green {
    background: var(--accent-green-light);
    color: var(--accent-green);
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-indigo);
    margin-bottom: 4px;
}

.kpi-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

/* ==========================================================================
   Tables & Data Presentation
   ========================================================================== */

.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header-bar {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-indigo);
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}

.data-table th {
    background: #f8fafc;
    padding: 12px 20px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-charcoal);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: #fbfcfe;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-charcoal);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-charcoal);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-indigo);
    box-shadow: 0 0 0 3px rgba(19, 0, 90, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary-indigo);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-indigo-dark);
    color: #fff;
}

.btn-accent {
    background: var(--accent-green);
    color: var(--primary-indigo);
    border-color: var(--accent-green);
}

.btn-accent:hover {
    background: var(--accent-green-hover);
    color: var(--primary-indigo);
}

.btn-secondary {
    background: #fff;
    color: var(--text-charcoal);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger-red);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

/* Flash alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13.5px;
}

.alert-success {
    background: var(--accent-green-light);
    border: 1px solid rgba(3, 201, 136, 0.3);
    color: #027a48;
}

.alert-danger {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #991b1b;
}

/* Modal Dialogs */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(19, 0, 90, 0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: modalPop 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Login Page Styling */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-indigo) 0%, #0c0038 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    position: relative;
    z-index: 10;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
    text-align: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .col-span-3 { grid-column: span 6; }
    .col-span-4 { grid-column: span 6; }
    .col-span-6 { grid-column: span 12; }
    .col-span-8 { grid-column: span 12; }
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .mobile-toggle {
        display: block;
    }
    .col-span-3, .col-span-4 {
        grid-column: span 12;
    }
    .content-container {
        padding: 16px;
    }
}
