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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --navbar-h: 70px;
    --sidebar-w: 260px;
    --sidebar-collapsed-w: 80px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-up {
    animation: fadeInUp 0.8s ease forwards;
}

.animate-fade {
    animation: fadeIn 1s ease forwards;
}

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

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    color: #94a3b8;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-w);
}

.sidebar-header {
    height: var(--navbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    letter-spacing: -0.5px;
    white-space: nowrap;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text span {
    color: var(--primary);
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    width: 0;
}

.sidebar-menu {
    flex: 1;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 0.5rem;
    color: #94a3b8;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid transparent;
}

.menu-item i {
    font-size: 1.25rem;
    min-width: 2rem;
    transition: var(--transition);
}

.menu-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
    padding-left: 1.5rem;
}

.menu-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: white;
    border: 1px solid rgba(37, 99, 235, 0.2);
    backdrop-filter: blur(10px);
}

.menu-item.active i {
    color: var(--primary);
    text-shadow: 0 0 15px rgba(37, 99, 235, 0.5);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.8);
}

.sidebar.collapsed .menu-item {
    padding: 0.875rem;
    justify-content: center;
}

.sidebar.collapsed .menu-item i {
    min-width: unset;
    margin: 0;
}

.sidebar.collapsed .menu-item.active::before {
    left: 4px;
}

.menu-text {
    white-space: nowrap;
    transition: var(--transition);
}

.sidebar.collapsed .menu-text {
    opacity: 0;
    width: 0;
}

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

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.profile-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    overflow: hidden;
    transition: var(--transition);
}

.profile-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
}

.profile-role {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
}

.logout-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.05);
    color: #ef4444;
    font-weight: 700;
    font-size: 0.875rem;
    width: 100%;
    border: 1px solid rgba(239, 68, 68, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.logout-item:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.sidebar.collapsed .sidebar-profile,
.sidebar.collapsed .logout-item span {
    display: none;
}

.sidebar.collapsed .logout-item {
    padding: 0.875rem;
    justify-content: center;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
}

.main-container {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.main-container.expanded {
    margin-left: var(--sidebar-collapsed-w);
}

.navbar {
    height: var(--navbar-h);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}

.toggle-btn:hover {
    background: var(--bg-body);
}

/* Grid Utilities */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.stats-grid-main {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .stats-grid-main {
        grid-template-columns: 1fr;
    }
}

.section-container {
    padding: 5rem 10%;
}

@media (max-width: 992px) {
    .section-container {
        padding: 4rem 5%;
    }
}

@media (max-width: 480px) {
    .section-container {
        padding: 3rem 1.25rem;
    }
}

/* Components */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: var(--bg-body);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-body);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Toast Alerts */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 10px;
    transform: translateX(120%);
    transition: var(--transition);
    border-left: 5px solid var(--primary);
}

.toast.show {
    transform: translateX(0);
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }

/* Landing Page Specific */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    padding: 4rem 10%;
    background: linear-gradient(135deg, #fff 0%, #f0f7ff 100%);
    position: relative;
    overflow: hidden;
}

.hero-content {
    flex: 1;
    z-index: 2;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.hero-title span {
    color: var(--primary);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    max-width: 600px;
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.hero-image img {
    max-width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* Mobile Adjustments */
@media (max-width: 992px) {
    .hero {
        flex-direction: column;
        padding: 6rem 5%;
        text-align: center;
    }
    .hero-title { font-size: 2.75rem; }
    .hero-subtitle { margin-left: auto; margin-right: auto; }
    .hero-image { margin-top: 3rem; }
    
    /* Grid fixes for mobile */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    :root {
        --navbar-h: 60px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    /* Backdrop when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
    }
    
    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .main-container {
        margin-left: 0 !important;
    }
    
    .navbar {
        padding: 0 1rem;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .hero-title { font-size: 2.25rem; }
    
    /* Stats grid fix */
    .stats-grid {
        gap: 1rem !important;
    }
}

@media (max-width: 480px) {
    .hero-title { font-size: 1.875rem; }
    .navbar .nav-right { display: none; } /* Simplified mobile header */
    .btn { width: 100%; } /* Stack buttons on very small screens */
}

/* Auth Pages Utilities */
.hide-on-mobile {
    display: flex;
}

.show-on-mobile {
    display: none;
}

@media (max-width: 992px) {
    .hide-on-mobile {
        display: none !important;
    }
    .show-on-mobile {
        display: block !important;
    }
}