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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #f59e0b;
    --accent: #10b981;
    --danger: #ef4444;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-dark: #1f2937;
    --text-muted: #6b7280;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: #f8fafc;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.95) 0%, rgba(79, 70, 229, 0.95) 100%);
    backdrop-filter: blur(10px);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.header a {
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header a:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

/* ===== CONTENT ===== */
.content {
    padding: 24px;
    padding-bottom: 90px;
}

/* ===== CARDS ===== */
.card {
    background: white;
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 20px 25px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.card h3 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-dark);
    font-weight: 700;
    letter-spacing: -0.3px;
}

.card p.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.45);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 14px;
}

.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* ===== BOOK GRID ===== */
.book-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.book-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.03);
}

.book-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.book-cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.book-info {
    padding: 16px;
}

.book-info h4 {
    font-size: 15px;
    margin-bottom: 6px;
    color: var(--text-dark);
    font-weight: 700;
    line-height: 1.3;
}

.book-info p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    padding: 14px 0 20px;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.1);
    z-index: 99;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.nav-item.active, .nav-item:hover {
    color: var(--primary);
}

.nav-item .icon {
    font-size: 26px;
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.nav-item.active .icon, .nav-item:hover .icon {
    transform: translateY(-2px);
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.badge-warning {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
}

.badge-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

/* ===== ALERTS ===== */
.alert {
    padding: 16px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ===== LOGIN & REGISTER ===== */
.login-box {
    max-width: 420px;
    margin: 40px auto;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-header .logo-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
}

.login-header h2 {
    color: var(--text-dark);
    font-size: 32px;
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -0.8px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 15px;
}

/* ===== DETAIL PAGE ===== */
.detail-cover {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-radius: 20px;
    margin-bottom: 24px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2);
}

/* ===== BORROW ITEMS ===== */
.borrow-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    border-left: 4px solid;
    transition: all 0.3s ease;
}

.borrow-item:hover {
    transform: translateX(4px);
}

.borrow-item.active {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left-color: #ef4444;
}

.borrow-item.history {
    background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
    border-left-color: #10b981;
}

.borrow-item img {
    width: 80px;
    height: 110px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== TABLES ===== */
.table-responsive {
    overflow-x: auto;
    border-radius: 14px;
}

.filter-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ===== ALERT AUTO HIDE ===== */
.alert {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert.fade-out {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th, table td {
    padding: 14px 16px;
    text-align: left;
}

table th {
    background: #f8fafc;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr {
    border-bottom: 1px solid #f1f5f9;
}

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

/* ===== DESKTOP VIEW ===== */
@media (min-width: 768px) {
    .container {
        max-width: 1200px;
        padding-bottom: 40px;
    }

    .header {
        padding: 28px 48px;
        border-radius: 0 0 24px 24px;
    }

    .header h1 {
        font-size: 28px;
    }

    .content {
        padding: 40px 48px;
        padding-bottom: 40px;
    }

    .card {
        padding: 32px;
    }

    .card h3 {
        font-size: 24px;
    }

    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
        margin-bottom: 32px;
    }

    .book-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }

    .book-cover {
        height: 240px;
    }

    .book-info {
        padding: 20px;
    }

    .book-info h4 {
        font-size: 16px;
    }

    .bottom-nav {
        position: static;
        transform: none;
        max-width: 100%;
        margin-top: 40px;
        border-radius: 20px;
        padding: 20px 0;
        gap: 48px;
    }

    .nav-item {
        font-size: 15px;
        flex-direction: row;
        gap: 10px;
    }

    .nav-item .icon {
        font-size: 30px;
        margin-bottom: 0;
    }

    .detail-cover {
        height: 400px;
    }

    .login-box {
        max-width: 480px;
        margin: 60px auto;
    }

    .login-header h2 {
        font-size: 36px;
    }

    table {
        font-size: 15px;
    }

    table th, table td {
        padding: 18px 20px;
    }
}

/* ===== EXTRA LARGE ===== */
@media (min-width: 1200px) {
    .book-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}
