* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.logo {
    font-weight: 800;
    font-size: 18px;
    color: #8b5cf6;
    text-decoration: none;
}
.main-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}
.main-nav a {
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.main-nav a:hover { color: #8b5cf6; }
.btn-logout { color: #ef4444 !important; }

/* Hero */
.hero {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    padding: 80px 0;
    text-align: center;
}
.hero h1 { font-size: 42px; margin-bottom: 16px; }
.hero p { font-size: 18px; opacity: 0.9; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }
.btn-outline {
    background: transparent;
    border: 2px solid currentColor;
    color: inherit;
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }
.btn-danger { background: #ef4444; color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-disabled { background: #cbd5e1; color: #64748b; cursor: not-allowed; }

/* Sections */
.section { padding: 48px 20px; }
.section h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: #1e293b;
}

/* Book grid */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.book-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: transform 0.15s, box-shadow 0.15s;
}
.book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.book-cover {
    width: 100%;
    height: 180px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 64px;
    font-weight: 800;
    margin-bottom: 12px;
}
.book-cover-md { width: 100px; height: 140px; font-size: 48px; }
.book-card h3 { font-size: 15px; margin-bottom: 4px; }
.book-author { color: #64748b; font-size: 12px; }
.book-category { color: #94a3b8; font-size: 11px; margin: 4px 0; }
.book-stock { font-size: 11px; color: #10b981; font-weight: 600; margin-bottom: 8px; }

/* Blog */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.blog-card, .blog-item {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}
.blog-item { margin-bottom: 20px; }
.blog-card h3, .blog-item h2 { font-size: 18px; margin-bottom: 8px; }
.blog-card h3 a, .blog-item h2 a {
    color: #1e293b;
    text-decoration: none;
}
.blog-card h3 a:hover, .blog-item h2 a:hover { color: #8b5cf6; }
.blog-meta { color: #94a3b8; font-size: 12px; margin-bottom: 12px; }
.read-more { color: #8b5cf6; text-decoration: none; font-weight: 600; font-size: 14px; }

/* Auth */
.auth-container {
    display: flex;
    justify-content: center;
    padding: 60px 20px;
}
.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border: 1px solid #e2e8f0;
}
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-subtitle { color: #64748b; margin-bottom: 24px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #64748b;
}
.auth-footer a { color: #8b5cf6; text-decoration: none; font-weight: 600; }
.auth-hint {
    margin-top: 24px;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 12px;
    color: #64748b;
}

/* Form */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}
.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}
.form-group input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
}
.form-actions { display: flex; gap: 12px; margin-top: 20px; }
.fieldset {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}
.fieldset legend {
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Tables */
.table-wrapper {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.data-table th {
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
}
.data-table tr:last-child td { border-bottom: none; }

/* Badge */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #166534; }

/* Dashboard */
.dashboard-header { padding: 32px 0 24px; }
.dashboard-header h1 { font-size: 28px; }
.dashboard-header p { color: #64748b; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}
.stat-label { font-size: 12px; color: #64748b; text-transform: uppercase; font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 800; color: #8b5cf6; margin-top: 8px; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-header h2 { font-size: 20px; }

/* Book detail */
.book-detail {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 32px;
    padding: 40px 0;
}
.book-detail-cover {
    width: 200px;
    height: 280px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 80px;
    font-weight: 800;
}
.book-detail-info h1 { font-size: 32px; margin-bottom: 8px; }
.book-detail-author { color: #64748b; margin-bottom: 20px; }
.book-meta {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px 16px;
    margin-bottom: 24px;
    font-size: 14px;
}
.book-meta dt { color: #64748b; font-weight: 600; }
.book-description {
    line-height: 1.8;
    color: #475569;
    margin-bottom: 24px;
}

/* Borrow */
.borrow-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e2e8f0;
    max-width: 600px;
    margin: 20px 0;
}
.borrow-book-info {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

/* Blog detail */
.blog-detail {
    max-width: 800px;
    padding: 40px 20px;
}
.back-link {
    display: inline-block;
    margin-bottom: 24px;
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.blog-detail h1 { font-size: 32px; margin-bottom: 12px; }
.blog-content { font-size: 16px; line-height: 1.8; color: #475569; }
.blog-content p { margin-bottom: 16px; }

/* Filter form */
.filter-form {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.filter-form input, .filter-form select {
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

/* Footer */
.site-footer {
    background: white;
    border-top: 1px solid #e2e8f0;
    padding: 20px 0;
    margin-top: 40px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.text-muted { color: #94a3b8; }

@media (max-width: 768px) {
    .hero h1 { font-size: 28px; }
    .book-detail { grid-template-columns: 1fr; }
    .book-detail-cover { width: 100%; max-width: 200px; }
    .header-inner { flex-direction: column; height: auto; padding: 12px 0; gap: 8px; }
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.modal-open {
    display: flex;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}
.modal-header h2 {
    font-size: 18px;
    margin: 0;
}
.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}
.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* Confirmation modal specific */
.modal-confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fef3c7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}
.modal-confirm-text {
    text-align: center;
    font-size: 15px;
    color: #475569;
}
.modal-confirm-details {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
    font-size: 14px;
}
.modal-confirm-details dl {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px 16px;
    margin: 0;
}
.modal-confirm-details dt {
    color: #64748b;
    font-weight: 600;
}
.modal-confirm-details dd {
    color: #1e293b;
    margin: 0;
}