:root {
    --primary: hsl(210, 24%, 16%);
    --secondary: hsl(45, 78%, 68%);
    --accent: hsl(28, 80%, 52%);
    --success: hsl(145, 63%, 42%);
    --danger: hsl(0, 72%, 56%);
    --bg-light: hsl(210, 20%, 98%);
    --bg-white: #ffffff;
    --text-main: hsl(210, 24%, 16%);
    --text-muted: hsl(210, 10%, 45%);
    --border-color: hsl(210, 14%, 89%);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Typography & Layout Utilities */
h1,
h2,
h3,
h4 {
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: 1rem;
}

/* Fluid Typography */
h1 {
    font-size: clamp(2rem, 8vw, 3.5rem);
}

h2 {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
}

h3 {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
}

h4 {
    font-size: clamp(1.1rem, 4vw, 1.25rem);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.logo h2 {
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
    font-size: clamp(1rem, 4.5vw, 1.5rem);
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a.btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 1rem;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: hsl(210, 24%, 22%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: hsl(45, 78%, 62%);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-light);
    border-color: var(--text-muted);
}

.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 12px;
    font-weight: 700;
}

.btn-outline-white {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-outline-white:hover {
    background: white;
    color: var(--primary);
    border-color: white;
}

/* Auth Pages */
.auth-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    background: var(--bg-white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Dashboard Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--primary);
    color: white;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    width: 280px;
    flex-shrink: 0;
}

.sidebar-brand {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-link {
    text-decoration: none;
    display: block;
}

.brand-container {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
}

.brand-link:hover .brand-container {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.brand-logo-img {
    height: 42px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.05));
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-name {
    color: white;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-bottom: 2px;
}

.brand-subtext {
    color: var(--secondary);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.9;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
    /* Space for scrollbar */
}

/* Custom scrollbar for sidebar */
.nav-menu::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.nav-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-item a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-item a:hover,
.nav-item a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item a i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem 0 2rem;
    /* Extra bottom padding for mobile safe areas */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-link {
    color: #f44336 !important;
    /* Vibrant Red */
    text-decoration: none;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 700;
}

.logout-link i {
    color: #f44336 !important;
}

.logout-link:hover {
    background: rgba(244, 67, 54, 0.1);
}

.main-content {
    background: var(--bg-light);
    padding: 2.5rem;
    overflow-y: auto;
    width: 100%;
    min-width: 0;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.card {
    background: var(--bg-white);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.card-title {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

/* Tables */
.table-container {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: hsl(210, 20%, 97%);
    padding: 1rem 1.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.1);
}

/* Badges */
.badge {
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-pending {
    background: #fff8e1;
    color: #f59e0b;
}

.badge-approved {
    background: #ecfdf5;
    color: #10b981;
}

.badge-rejected {
    background: #fef2f2;
    color: #ef4444;
}

/* Responsive adjustments */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary);
    cursor: pointer;
}

@media (max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .sidebar.active {
        display: flex;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 2000;
        height: 100vh;
        box-shadow: 10px 0 30px rgba(0,0,0,0.3);
        transition: transform 0.3s ease;
    }

    .main-content {
        padding: 0.75rem;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0 !important;
        overflow-x: visible; /* Prevent clipping of horizontal scroll interactions */
        flex: 1; /* Ensure it takes available space in flex layout */
    }

    .dashboard-layout {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    /* Fixed table-responsive wrapper behavior */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        
        /* Premium Scroll Indicators */
        background: 
            linear-gradient(to right, white 30%, rgba(255,255,255,0)), 
            linear-gradient(to right, rgba(255,255,255,0), white 70%) 100% 0, 
            radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.1), rgba(0,0,0,0)), 
            radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.1), rgba(0,0,0,0)) 100% 0;
        background-repeat: no-repeat;
        background-color: white;
        background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        background-attachment: local, local, scroll, scroll;
    }

    /* Custom Scrollbar for better visibility */
    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }
    .table-responsive::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    .table-responsive::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 10px;
    }
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: var(--primary);
    }
    
    /* Force table to be scrollable and NOT squished */
    .table-responsive table {
        margin-bottom: 0;
        min-width: 850px !important; /* Forces horizontal scroll on mobile */
        table-layout: auto !important;
    }

    /* Swipe Hint for tables */
    .table-responsive::before {
        content: "← Swipe left/right to see more →";
        display: block;
        text-align: center;
        font-size: 0.7rem;
        color: var(--accent);
        padding: 4px;
        background: var(--bg-light);
        font-weight: 700;
        border-bottom: 1px solid var(--border-color);
    }
}

/* Page Header & User Info Responsive */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    width: 100%;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .page-header {
        padding: 0.75rem 1rem;
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 480px) {
    /* Show designation even on small screens */
    .user-info .designation {
        display: block;
        font-size: 0.7rem;
    }

    .card {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem 1.5rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1.5rem;
        gap: 1rem;
        border-bottom: 1.5px solid var(--border-color);
        box-shadow: var(--shadow-md);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links .btn {
        width: 100%;
    }

    .hero-content h1 {
        font-size: 2.25rem !important;
        color: white !important;
    }

    .hero-content p {
        font-size: 1rem !important;
        color: white !important;
    }

    .auth-container {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.75rem 1rem;
    }

    .logo h2 {
        font-size: clamp(0.9rem, 4vw, 1.1rem);
    }

    .main-content {
        padding: 0.5rem;
        width: 100% !important;
    }

    .card {
        padding: 0.6rem;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Dashboard specific table override to fit metrics without scrolling */
    /* Ensure tables can scroll horizontally but don't squish too much */
    .table-dashboard table {
        min-width: 600px !important;
    }
}

/* Responsive Utilities */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 576px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.split-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
}

.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

@media (max-width: 992px) {
    .split-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .responsive-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .hero-section {
        padding: 6rem 1.5rem;
    }
}

/* Hero Section */
.hero-section {
    position: relative;
    padding: 10rem 1.5rem;
    text-align: center;
    background: url('https://images.unsplash.com/photo-1541888946425-d81bb19240f5?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.7));
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.hero-content h1 {
    font-size: clamp(2.25rem, 8vw, 4rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    font-weight: 800;
    color: white !important;
}

.hero-content p {
    font-size: clamp(0.95rem, 4vw, 1.25rem);
    opacity: 0.9;
    margin-bottom: 2.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    color: white !important;
}

.hero-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Feature Cards */
.feature-card {
    text-align: center;
    padding: 3rem 1.5rem;
    transition: var(--transition);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-light);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1.5rem;
    transition: var(--transition);
}

.feature-card:hover .feature-icon {
    background: var(--primary);
    color: white;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 6rem 1.5rem;
        min-height: 60vh;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .hero-actions .btn {
        width: 100%;
    }
}

/* Footer Section */
.footer {
    background: var(--primary);
    color: white;
    padding: 5rem 1.5rem 3rem;
    text-align: center;
    margin-top: 5rem;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-info h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.footer-info p {
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto 2.5rem;
}

.footer-links div {
    display: flex;
    gap: 2rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.footer-links a {
    color: white;
    font-size: 1.25rem;
    opacity: 0.7;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
    color: var(--secondary);
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2.5rem;
}

.footer-bottom p {
    font-size: 0.9rem;
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .footer {
        padding: 4rem 1rem 2rem;
    }

    .footer-info h3 {
        font-size: 1.25rem;
    }

    .footer-links div {
        gap: 1.5rem;
    }
}