:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #3b82f6;
    --success: #22c55e;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --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);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark);
}

body.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Login */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    width: 100%;
}

.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 2.5rem 3rem;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-header h2 {
    font-size: 1.8rem;
    color: var(--dark);
}

.login-header p {
    color: var(--gray);
    font-size: 0.95rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.login-form .form-group label i {
    margin-right: 8px;
    color: var(--primary);
}

.login-form .form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.login-btn {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.login-note {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray);
    font-size: 0.85rem;
}

/* Navbar */
.navbar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: sticky;
    top: 20px;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand i {
    font-size: 2rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--dark);
}

.user-info i {
    font-size: 1.5rem;
    color: var(--primary);
}

.logout-btn {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #fecaca;
}

/* Main Content */
.main-content {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.main-content h1 {
    text-align: center;
    color: var(--dark);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* PDF Grid */
.pdf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.pdf-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
}

.pdf-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.pdf-image-wrapper {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f1f5f9;
}

.pdf-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pdf-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(37, 99, 235, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: all 0.3s ease;
}

.pdf-card:hover .pdf-overlay {
    opacity: 1;
}

.pdf-overlay i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.pdf-info {
    padding: 1.5rem;
}

.pdf-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdf-meta {
    display: flex;
    justify-content: space-between;
    color: var(--gray);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.pdf-meta i {
    margin-right: 4px;
}

.view-pdf-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.view-pdf-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
}

.no-results i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    margin: 2.5rem auto;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 0.8rem 2rem;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.3s ease;
    line-height: 1;
}

.close-btn:hover {
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    overflow: hidden;
}

/* PDF Toolbar */
.pdf-toolbar {
    display: none;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1rem;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-wrap: wrap;
}

.pdf-toolbar button {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.pdf-toolbar button:hover {
    background: rgba(255,255,255,0.2);
}

.pdf-toolbar button i {
    font-size: 1rem;
}

.pdf-toolbar span {
    color: #cbd5e1;
    font-size: 0.9rem;
    user-select: none;
}

#pageInfo {
    min-width: 60px;
    text-align: center;
}

#zoomLevel {
    min-width: 50px;
    text-align: center;
}

/* PDF Viewer Container */
#pdfContainer {
    flex: 1;
    position: relative;
    overflow: auto;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

#pdfViewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 100%;
}

#pdfViewer canvas {
    display: block;
    max-width: 100%;
    height: auto !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    margin: 0 auto;
}

#loadingMsg {
    color: white;
    text-align: center;
    padding: 3rem;
    font-size: 1.2rem;
}

/* Security Alert */
.security-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ef4444;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.security-alert i {
    font-size: 1.2rem;
}

/* Messages */
.message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.message.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.message.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }
    .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }
    .pdf-grid {
        grid-template-columns: 1fr;
    }
    .modal-content {
        width: 98%;
        height: 95vh;
        margin: 0.5rem auto;
    }
    .modal-header {
        padding: 0.5rem 1rem;
    }
    .pdf-toolbar {
        padding: 0.4rem 0.5rem;
        gap: 5px;
    }
    .pdf-toolbar button {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    .login-card {
        padding: 1.5rem;
    }
    .main-content {
        padding: 1rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

#pdfContainer {
    flex: 1;
    overflow-y: auto;
    background: #1a1a1a;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#pdfViewer {
    width: 100%;
    max-width: 1200px; /* optional */
    display: flex;
    flex-direction: column;
    align-items: center;
}

#pdfViewer canvas {
    max-width: 100%;
    height: auto !important;
    border-radius: 4px;
    margin-bottom: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}