@import url('https://fonts.googleapis.com/css2?family=Google+Sans+Flex:opsz,wght@8..144,100..1000&display=swap');

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

body {
    background: #f4f6f9;
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container,
.form-container,
.upload-container,
.search-container {
    width: 450px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin: 40px auto;
}

.wide {
    width: 95%;
}

input {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    outline: none;
}

button,
.download-btn {
    width: 100%;
    padding: 12px;
    border: none;
    background: #2563eb;
    color: white;
    border-radius: 8px;
    margin-top: 20px;
    cursor: pointer;
    text-decoration: none;
    display: block;
    text-align: center;
}

/* Layout */
body {
    background: #f8fafc;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 260px;
    height: 100vh;
    background: #0f172a;
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-header {
    height: 64px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.logo-text {
    display: none;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

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

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.sidebar-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar-nav a.active {
    background: #3b82f6;
    color: white;
}

.sidebar-nav a i {
    width: 24px;
    height: 24px;
    min-width: 24px;
}

.sidebar.collapsed .sidebar-nav a span {
    display: none;
}

.nav-divider {
    padding: 16px 12px 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #475569;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.sidebar.collapsed .nav-divider {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    margin-left: 260px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sidebar-collapsed .main-content {
    margin-left: 80px;
}

.top-header {
    height: 64px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 999;
}

.toggle-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: #f1f5f9;
}

.content-wrapper {
    padding: 32px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Cards & Components */
.page-header, .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-icon {
    width: 48px;
    height: 48px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card h3 {
    font-size: 1.25rem;
    color: #1e293b;
}

.card p {
    color: #64748b;
    font-size: 0.875rem;
}

/* Forms */
.form-container {
    background: white;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: 0 auto;
}

.form-container.wide {
    max-width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 6px;
}

input, select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s, ring 0.2s;
}

input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tables */
.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    margin-top: 24px;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.875rem;
    white-space: nowrap;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover {
    background: #f8fafc;
}

.badge {
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-admin { background: #fee2e2; color: #991b1b; }
.badge-user { background: #dcfce7; color: #166534; }

.btn-action {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
}

.btn-action.delete {
    color: #ef4444;
}

/* Login Page specific */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f1f5f9;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
    text-align: center;
}

.login-card p {
    color: #64748b;
    text-align: center;
    margin-bottom: 32px;
}

/* Mobile Responsiveness */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-active {
        transform: translateX(0);
        width: 260px; /* Always show full width on mobile when open */
    }

    .sidebar.mobile-active .logo-text,
    .sidebar.mobile-active .sidebar-nav a span {
        display: block; /* Ensure text shows when open on mobile */
        opacity: 1;
        width: auto;
    }
    
    .sidebar.mobile-active .nav-divider {
        display: block;
    }

    .main-content,
    .sidebar-collapsed .main-content {
        margin-left: 0;
    }

    #mobile-sidebar-toggle {
        display: block !important;
    }

    .content-wrapper {
        padding: 16px;
    }

    .form-container,
    .login-container,
    .search-container,
    .upload-container {
        padding: 20px;
        margin: 20px auto;
        width: 100%;
    }
}
