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

:root {
    --primary-color: #4F46E5; /* Indigo 600 - Default if not set */
    --primary-hover: #4338CA;
    --secondary-color: #10B981; /* Emerald 500 - Default if not set */
    --bg-color: #F3F4F6;
    --sidebar-bg: #111827; /* Gray 900 */
    --sidebar-hover: #1F2937;
    --text-color: #1F2937;
    --text-muted: #6B7280;
    --text-light: #F9FAFB;
    --card-bg: #FFFFFF;
    --border-color: #E5E7EB;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* ==================================
   LOGIN PAGE (Enhanced)
   ================================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100vw;
    background: linear-gradient(135deg, var(--sidebar-bg) 0%, #000000 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    top: -50%;
    left: -50%;
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.login-card h2 {
    margin-bottom: 2rem;
    color: var(--sidebar-bg);
    font-size: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    transition: var(--transition);
    background: #F9FAFB;
    font-size: 1rem;
}

.form-group input:focus {
    border-color: var(--primary-color);
    background: #FFFFFF;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Outfit', sans-serif;
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    background-color: #FEE2E2;
    color: #DC2626;
    border: 1px solid #F87171;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ==================================
   ADMIN DASHBOARD
   ================================== */

.dashboard-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 80px; /* Collapsed width */
    background-color: var(--sidebar-bg);
    color: var(--text-light);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    transition: var(--transition);
    z-index: 100;
    overflow: hidden;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.sidebar:hover {
    width: 280px; /* Expanded width */
}

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}

.sidebar-header .logo-icon {
    min-width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    font-family: 'Outfit', sans-serif;
}

.sidebar-header .logo-text {
    margin-left: 15px;
    font-size: 1.4rem;
    font-weight: 700;
    opacity: 0;
    transition: var(--transition);
}

.sidebar:hover .sidebar-header .logo-text {
    opacity: 1;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-light);
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: var(--secondary-color);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.05);
    border-right: 4px solid var(--primary-color);
    color: var(--secondary-color);
}

.nav-icon {
    min-width: 40px;
    display: flex;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-text {
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 500;
}

.sidebar:hover .nav-text {
    opacity: 1;
}

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

.logout-btn {
    display: flex;
    align-items: center;
    color: #FCA5A5;
    text-decoration: none;
    transition: var(--transition);
}

.logout-btn:hover {
    color: #EF4444;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 80px; /* Offset for collapsed sidebar */
    padding: 2rem;
    transition: var(--transition);
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}

.topbar-title h2 {
    color: var(--text-color);
    font-size: 1.5rem;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), #34D399);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.user-info h4 {
    margin: 0;
    font-size: 1rem;
}

.user-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.1); color: #3B82F6; }
.stat-icon.green { background: rgba(16, 185, 129, 0.1); color: #10B981; }
.stat-icon.purple { background: rgba(139, 92, 246, 0.1); color: #8B5CF6; }
.stat-icon.orange { background: rgba(249, 115, 22, 0.1); color: #F97316; }

.stat-details h3 {
    font-size: 2rem;
    margin-bottom: 0.2rem;
    color: var(--text-color);
}

.stat-details p {
    color: var(--text-muted);
    font-weight: 500;
}

/* Welcome Area */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    border-radius: var(--border-radius);
    padding: 2.5rem;
    color: white;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
}

.welcome-banner h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 2;
}

.welcome-banner p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    position: relative;
    z-index: 2;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    right: -50px;
    top: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    border-radius: 50%;
}

/* Add horizontal scroll to tables so they don't break layout */
table {
    white-space: nowrap;
}
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* ==================================
   MOBILE RESPONSIVENESS
   ================================== */
@media (max-width: 768px) {
    /* Transform Sidebar into Bottom Navigation */
    .sidebar {
        width: 100%;
        height: 60px;
        position: fixed;
        bottom: 0;
        left: 0;
        top: auto;
        flex-direction: row;
        z-index: 1000;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.1);
    }
    
    .sidebar:hover {
        width: 100%;
    }
    
    .sidebar-header, .sidebar-footer, .logo-text {
        display: none !important;
    }
    
    .sidebar-nav {
        display: flex;
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        padding: 0;
        overflow-x: auto;
        -ms-overflow-style: none; /* IE and Edge */
        scrollbar-width: none; /* Firefox */
    }
    
    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }
    
    .nav-item {
        padding: 10px;
        flex: 1;
        justify-content: center;
        border-right: none;
    }
    
    .nav-item.active {
        border-right: none;
        border-top: 3px solid var(--primary-color);
        background-color: rgba(255,255,255,0.05);
    }
    
    .nav-item:hover .nav-text, .sidebar:hover .nav-text {
        display: none !important;
    }
    
    .nav-text {
        display: none !important;
    }
    
    /* Main Content Area */
    .main-content {
        margin-left: 0;
        padding: 1rem;
        margin-bottom: 70px; /* Space for bottom nav */
    }
    
    .dashboard-layout {
        flex-direction: column;
    }
    
    /* Topbar adjustments */
    .topbar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    /* Tables need to scroll on small screens */
    div[style*="overflow-x"] {
        /* Ensuring manual inline styles don't conflict */
    }
    
    /* Cards and Grids */
    .dashboard-grid, div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .welcome-banner {
        padding: 1.5rem;
    }
    
    .welcome-banner h1 {
        font-size: 1.5rem;
    }

    /* Wrap tables on mobile natively if not wrapped */
    table {
        display: block;
        max-width: -moz-fit-content;
        max-width: fit-content;
        margin: 0 auto;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
    }
}
