:root {
    --primary-blue: #2563eb;
    --primary-blue-dark: #1e40af;
    --primary-blue-light: #3b82f6;
    --secondary-gray: #64748b;
    --accent-orange: #f97316;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #475569;
    --border-color: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-light);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(to bottom right, #dbeafe, #f8fafc);
}

.form-wrapper {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 48px;
    width: 100%;
    max-width: 480px;
    border: 1px solid var(--border-color);
}

.form-header {
    text-align: center;
    margin-bottom: 32px;
}

.form-header h1 {
    color: var(--primary-blue);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.form-header p {
    color: var(--text-gray);
    font-size: 15px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--bg-white);
    color: var(--text-dark);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-gray);
    font-size: 13px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-light);
    border-color: var(--secondary-gray);
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
}

.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: var(--error);
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: var(--success);
}

.form-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

.form-footer p {
    color: var(--text-gray);
    font-size: 14px;
}

.form-footer a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.form-footer a:hover {
    color: var(--primary-blue-dark);
    text-decoration: underline;
}

/* Navbar */
.navbar {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    padding: 18px 0;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand::before {
    content: "📚";
    font-size: 28px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-user {
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

/* Dashboard */
.dashboard-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 48px;
    padding: 32px;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.dashboard-header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary-blue);
}

.dashboard-header p {
    font-size: 16px;
    color: var(--text-gray);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 36px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-blue);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 52px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 600;
}

.upload-section, .recent-imports, .view-data-section {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 36px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-header h2 {
    color: var(--text-dark);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: 24px;
}

.upload-area {
    margin-bottom: 24px;
}

.upload-area input[type="file"] {
    display: none;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    border: 3px dashed var(--border-color);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-gray);
    background: var(--bg-light);
}

.upload-label:hover {
    border-color: var(--primary-blue);
    background: #dbeafe;
}

.upload-label svg {
    color: var(--primary-blue);
    margin-bottom: 16px;
}

.upload-label span {
    font-size: 15px;
    font-weight: 500;
}

.file-name {
    margin-top: 12px;
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 14px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
}

.data-table thead {
    background: var(--bg-light);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-dark);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-dark);
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

.text-success {
    color: var(--success);
    font-weight: 600;
}

.text-error {
    color: var(--error);
    font-weight: 600;
}

.no-data {
    text-align: center;
    color: var(--text-gray);
    padding: 48px;
    font-size: 15px;
}

.view-data-section {
    text-align: center;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 32px;
}

.page-info {
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.result-wrapper {
    background: var(--bg-white);
    border-radius: 16px;
    padding: 48px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.result-wrapper h1 {
    color: var(--text-dark);
    margin-bottom: 24px;
    font-weight: 700;
}

.import-summary {
    margin: 32px 0;
}

.import-summary h2 {
    color: var(--text-dark);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.summary-item {
    background: var(--bg-light);
    padding: 24px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border-color);
}

.summary-label {
    font-size: 13px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.summary-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-blue);
}

.error-details {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--error);
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
}

.error-details h3 {
    color: var(--error);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.error-details ul {
    list-style: none;
    padding: 0;
}

.error-details li {
    padding: 10px 0;
    color: var(--text-dark);
    font-size: 13px;
    border-bottom: 1px solid #fee2e2;
}

.error-details li:last-child {
    border-bottom: none;
}

.note {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-gray);
    font-style: italic;
}

.action-buttons {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 10px;
    }
}

/* Session timeout warning banner */
.session-timeout-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #fef3c7;
    color: #92400e;
    text-align: center;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid #f59e0b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}
