:root {
    --primary: #f97316; /* Original Modern Orange (Tailwind Orange-500) */
    --primary-hover: #ea580c; /* Orange-600 */
    --primary-light: rgba(249, 115, 22, 0.1);
    
    --bg-body: #f3f4f6; /* Light Gray */
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b; /* Dark Slate Sidebar for Professional Look */
    
    --text-main: #111827; /* Dark Gray */
    --text-secondary: #4b5563; /* Medium Gray */
    --text-muted: #9ca3af; /* Muted Gray */
    --text-sidebar: #f8fafc; /* Light Text for Sidebar */
    --text-sidebar-muted: #94a3b8; /* Muted Text for Sidebar */
    
    --border: #e5e7eb; /* Light Border */
    --border-dark: #334155; /* Dark Border for Sidebar */
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --radius: 0.375rem; /* Balanced radius (6px) */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --header-height: 64px;
}

body.dark-theme {
    --primary: #fb923c;
    --primary-hover: #f97316;
    
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    
    --text-main: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --text-sidebar: #f9fafb;
    --text-sidebar-muted: #9ca3af;
    
    --border: #334155;
    --border-dark: #1e293b;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    font-size: 15px; /* Slightly more dense */
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0.75em;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
    font-weight: 500;
}
a:hover { color: var(--primary-hover); text-decoration: underline; }

/* === Layout & Containers === */
.container {
    max-width: 1400px; /* Enterprise width */
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* === Header === */
header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.05em;
    text-transform: uppercase;
}
.logo span { color: var(--primary); }
.logo:hover { text-decoration: none; }

nav { display: flex; align-items: center; gap: 1.5rem; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease-in-out;
    line-height: 1.25rem;
    text-transform: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--text-muted);
    background-color: var(--bg-body);
    color: var(--text-main);
    text-decoration: none;
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* === Dashboard Layout === */
.dashboard-wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    background-color: var(--bg-body);
}

/* Sidebar */
.dashboard-sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 40;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1); /* Subtle shadow for depth */
}

.sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-header h3 { 
    font-size: 0.75rem; 
    color: var(--text-sidebar-muted); 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    margin: 0; 
    font-weight: 700;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-sidebar-muted);
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    border-left: none;
}

.nav-item .icon {
    margin-right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    text-align: center;
    color: var(--text-sidebar-muted);
    opacity: 0.8;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-sidebar);
    text-decoration: none;
}
.nav-item:hover .icon { opacity: 1; color: var(--text-sidebar); }

.nav-item.active {
    background-color: var(--primary); /* Orange Background */
    color: white; /* White Text */
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.3); /* Orange glow */
}
.nav-item.active .icon { color: white; opacity: 1; }

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    background-color: rgba(0,0,0,0.1);
}

.user-role-badge {
    padding: 0;
    background-color: transparent;
    border: none;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.user-role-badge small { color: var(--text-sidebar-muted); display: block; margin-bottom: 0.25rem; }
.user-role-badge strong { color: var(--text-sidebar); font-size: 0.95rem; }

.logout-link {
    color: var(--text-sidebar-muted);
    padding-left: 1rem;
    opacity: 0.8;
}
.logout-link:hover { 
    background-color: rgba(239, 68, 68, 0.1); 
    color: #fca5a5; 
    opacity: 1;
}

/* Main Content Area */
.dashboard-main {
    flex: 1;
    margin-left: 280px; /* Match sidebar width */
    padding: 2rem;
    width: calc(100% - 280px);
}

/* Constraint for Wide Screens */
.dashboard-container-limit {
    max-width: 1400px; /* Optimal reading width */
    margin: 0 auto;    /* Center content */
}

.dashboard-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}
.dashboard-content-header h2 { 
    font-size: 1.5rem; 
    color: var(--text-main); 
    margin: 0;
    font-weight: 700;
}

.date-info {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Card Styling */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    padding: 0; /* Remove default padding to handle header/body separately */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* For header radius */
}

.card-header {
    background-color: #f8fafc; /* Very light slate */
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
}

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

.card-body {
    padding: 1.5rem;
}

/* Dashboard Grid - Symmetrical Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 Columns for symmetry */
    gap: 1.5rem;
    align-items: stretch; /* Make cards same height */
}

/* Special Classes for Grid Items */
.card-full-width {
    grid-column: 1 / -1; /* Span all columns */
}

.card-half-width {
    grid-column: span 2;
}

.search-card .card-body {
    background: linear-gradient(to right, #f8fafc, #fff);
}

.empty-state {
    text-align: center;
    padding: 3rem 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    background-color: var(--bg-body);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* Forms */
input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    color: var(--text-main);
    background-color: var(--bg-card);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.search-form-small {
    display: flex;
    gap: 0.75rem;
}
.search-form-small input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s;
}
.search-form-small input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}
.search-form-small button {
    padding: 0 2rem;
    font-weight: 600;
}

/* Status Indicators */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}
.status-success { background-color: #dcfce7; color: #166534; }
.status-warning { background-color: #fef9c3; color: #854d0e; }
.status-error { background-color: #fee2e2; color: #991b1b; }

/* Landing Page Hero */
.hero {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); /* Deep gradient */
    color: white;
    padding: 8rem 0 6rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle pattern overlay for hero */
.hero::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.5;
}

.hero h1 { 
    font-size: 3.5rem; 
    margin-bottom: 1.5rem; 
    color: white; 
    font-weight: 800;
    letter-spacing: -0.025em;
    position: relative;
    text-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.hero p { 
    font-size: 1.25rem; 
    color: #cbd5e1; 
    max-width: 700px; 
    margin: 0 auto 3rem; 
    line-height: 1.6;
    position: relative;
}

.search-form { 
    max-width: 700px; 
    margin: 0 auto; 
    display: flex; 
    gap: 0.75rem; 
    position: relative;
    background: rgba(255,255,255,0.05);
    padding: 0.75rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
}

.search-form input { 
    border: none; 
    padding: 1rem 1.5rem; 
    font-size: 1.125rem; 
    background: white;
    border-radius: 0.375rem;
    flex: 1;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.search-form button { 
    padding: 1rem 2.5rem; 
    font-size: 1.125rem; 
    font-weight: 600;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.4);
}

/* Landing Features */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1200px;
    margin: -3rem auto 4rem; /* Overlap hero */
    padding: 0 2rem;
    position: relative;
    z-index: 10;
}
.feature-card {
    background: white;
    padding: 2.5rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem; /* Slightly softer */
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.feature-card h3 { 
    color: var(--text-main); 
    margin-bottom: 1rem; 
    font-size: 1.25rem; 
    font-weight: 700;
}
.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-full-width { grid-column: 1 / -1; }
    .card-half-width { grid-column: 1 / -1; } /* Stack on tablet */
}

@media (max-width: 768px) {
    .features { grid-template-columns: 1fr; gap: 1.5rem; }
    .hero { padding: 4rem 0 3rem; }
    .hero h1 { font-size: 2.25rem; }
    .hero p { font-size: 1rem; }
    .search-form { flex-direction: column; }
    .search-form button { width: 100%; }
    
    .dashboard-wrapper { flex-direction: column; }
    .dashboard-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-dark);
        padding: 0;
        box-shadow: none;
    }
    .sidebar-header, .sidebar-footer { display: none; }
    .sidebar-nav { 
        flex-direction: row; 
        padding: 0.5rem; 
        gap: 0.5rem; 
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-item { 
        flex: 0 0 auto; 
        padding: 0.5rem 1rem; 
        font-size: 0.9rem;
    }
    
    .dashboard-main { margin-left: 0; width: 100%; padding: 1rem; }
    
    .dashboard-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 1rem;
    }
    .card-full-width, .card-half-width { grid-column: 1 / -1; }
    
    .search-form-small { flex-direction: column; }
    .search-form-small button { width: 100%; }
}
