/* =========================================================================
   1. PIXEL-PERFECT PREMIUM SAAS CONFIGURATION (AS PER ORIGINAL SCREENSHOT)
   ========================================================================= */
:root {
    /* Main Layout Colors */
    --bg-app: #f4f6f9;            /* Extremely soft light gray for the main body */
    --bg-sidebar: #1e1b4b;        /* The Premium Deep Navy/Purple for the sidebar */
    --bg-panel: #ffffff;          /* Pure white for cards */
    
    /* Primary Brand Colors */
    --primary: #4f46e5;           /* The exact vibrant indigo from the screenshot */
    --primary-hover: #4338ca;
    
    /* Icon Box Tint Colors (Pastel Backgrounds + Vibrant Icons) */
    --tint-blue-bg: #eef2ff;
    --tint-blue-text: #4f46e5;
    --tint-red-bg: #fef2f2;
    --tint-red-text: #ef4444;
    --tint-yellow-bg: #fffbeb;
    --tint-yellow-text: #f59e0b;
    --tint-green-bg: #ecfdf5;
    --tint-green-text: #10b981;
    
    /* Typography Palette */
    --text-sidebar: #a5b4fc;      /* Muted blue/gray for sidebar text */
    --text-sidebar-active: #ffffff;
    --text-dark: #0f172a;         /* Deep slate for main headings */
    --text-muted: #64748b;        /* Slate for subtitles */
    
    /* Soft 3D Elevation (No Borders) */
    --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.04);
    --shadow-button: 0 4px 14px rgba(79, 70, 229, 0.4);
    
    /* Heavily Rounded Corners from Screenshot */
    --radius-sm: 8px;
    --radius-menu: 12px;
    --radius-card: 20px;
    --radius-banner: 24px;
    --radius-pill: 50px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================================
   2. GLOBAL RESET & TYPOGRAPHY
   ========================================================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-app);
    color: var(--text-dark);
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { text-decoration: none; transition: var(--transition); }
ul { list-style: none; }

/* =========================================================================
   3. SIDEBAR (DEEP NAVY / PURPLE)
   ========================================================================= */
.app-wrapper {
    display: flex;
    flex-grow: 1;
}

.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.brand-section {
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.brand-section h1 {
    font-size: 1.5rem;
    color: #ffffff; 
    font-weight: 700;
}

.nav-category {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.5rem 0 0.5rem 0.5rem;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-menu);
    color: var(--text-sidebar);
    font-weight: 500;
    font-size: 0.95rem;
}

.menu-item.active a, .menu-item a:hover {
    background-color: var(--primary);
    color: var(--text-sidebar-active);
    box-shadow: var(--shadow-button);
}

/* =========================================================================
   4. MAIN VIEWPORT & TOP BAR
   ========================================================================= */
.main-viewport {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-navbar {
    background-color: transparent; 
    padding: 1.5rem 2.5rem 0 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-navbar h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition: var(--transition);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

/* Profile Pill */
.profile-pill {
    background-color: #ffffff;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    border-radius: var(--radius-pill);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-card);
    font-weight: 600;
    font-size: 0.9rem;
}

.profile-avatar {
    background-color: var(--primary);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-body {
    padding: 1.5rem 2.5rem;
    flex-grow: 1;
}

/* =========================================================================
   5. WELCOME BANNER (THE PREMIUM GRADIENT)
   ========================================================================= */
.welcome-banner {
    background: linear-gradient(135deg, #5b45f4 0%, #4632d4 100%);
    border-radius: var(--radius-banner);
    padding: 3rem 2.5rem;
    color: #ffffff;
    margin-bottom: 2rem;
    box-shadow: 0 15px 30px rgba(91, 69, 244, 0.2);
    position: relative;
    overflow: hidden;
}

.welcome-banner h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.welcome-banner p {
    font-size: 1rem;
    opacity: 0.9;
}

/* =========================================================================
   6. METRICS CARDS & TINTED ICONS
   ========================================================================= */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.card {
    background-color: var(--bg-panel);
    border-radius: var(--radius-card); 
    padding: 1.75rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.08);
}

.icon-box {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
}

/* Icon Box Color Variations */
.icon-blue { background-color: var(--tint-blue-bg); color: var(--tint-blue-text); }
.icon-red { background-color: var(--tint-red-bg); color: var(--tint-red-text); }
.icon-yellow { background-color: var(--tint-yellow-bg); color: var(--tint-yellow-text); }
.icon-green { background-color: var(--tint-green-bg); color: var(--tint-green-text); }

.card-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.card-value {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

/* =========================================================================
   7. PREMIUM DATA TABLES (100% RESPONSIVE)
   ========================================================================= */
.table-container {
    background-color: var(--bg-panel);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow-x: auto; 
    margin-top: 1rem;
    padding: 0.5rem 1rem; 
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px; 
}

.custom-table th {
    padding: 1.25rem 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #f1f5f9; 
}

.custom-table td {
    padding: 1.25rem 1rem;
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 500;
    border-bottom: 1px solid #f8fafc;
}

.custom-table tbody tr {
    transition: var(--transition);
}

.custom-table tbody tr:hover {
    background-color: #f8fafc; 
}

/* Custom Status Badge overrides for the table */
.status-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =========================================================================
   8. FOOTER
   ========================================================================= */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto; 
}

/* =========================================================================
   9. RESPONSIVENESS (MOBILE & TABLET)
   ========================================================================= */
@media screen and (max-width: 1024px) {
    .sidebar { width: 90px; padding: 1.5rem 0.5rem; align-items: center; }
    .brand-section h1, .nav-category, .menu-item span, .fa-chevron-right { display: none; }
    .menu-item a { justify-content: center; padding: 1rem; }
    .content-body, .top-navbar { padding: 1.5rem; }
}

@media screen and (max-width: 768px) {
    .app-wrapper { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
    }
    .brand-section { margin: 0; padding: 0; }
    .brand-section h1 { display: block; font-size: 1.25rem; }
    .menu-list { flex-direction: row; gap: 0.5rem; overflow-x: auto; }
    .nav-category { display: none; }
    .top-navbar { flex-direction: column; gap: 1rem; align-items: flex-start; padding: 1.5rem 1.5rem 0 1.5rem; }
    .content-body { padding: 1rem 1.5rem; }
    .metrics-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   10. AUTHENTICATION PAGES (LOGIN & REGISTER)
   ========================================================================= */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-sidebar) 0%, #4632d4 100%);
    padding: 1.5rem;
}

.auth-card {
    background-color: var(--bg-panel);
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-banner); /* 24px heavy rounding */
    padding: 3rem 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.25rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-dark);
    background-color: var(--bg-app); /* Soft gray background instead of borders */
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.auth-btn {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
    font-size: 1rem;
    margin-top: 1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.alert-error {
    background-color: var(--tint-red-bg);
    color: var(--tint-red-text);
}

.alert-success {
    background-color: var(--tint-green-bg);
    color: var(--tint-green-text);
}

/* =========================================================================
   11. PROFILE DROPDOWN (PREMIUM HOVER EFFECT)
   ========================================================================= */
.profile-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    background-color: var(--bg-panel);
    min-width: 200px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-sm);
    z-index: 100;
    overflow: hidden;
    animation: fadeInDropdown 0.2s ease-in-out;
}

/* Show dropdown on hover */
.profile-container:hover .profile-dropdown {
    display: block;
}

.profile-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-dark);
    padding: 0.85rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.profile-dropdown a:hover {
    background-color: var(--bg-app);
    color: var(--primary);
}

.profile-dropdown .text-danger {
    color: var(--tint-red-text);
    border-top: 1px solid #f1f5f9;
}

.profile-dropdown .text-danger:hover {
    background-color: var(--tint-red-bg);
}

@keyframes fadeInDropdown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}