/* ================================================================
   eLibrary ITM — style.css
   Clean, offline-ready, no tumpang tindih
   ================================================================ */

:root {
    --primary:        #0284c7; /* Solid sky blue */
    --primary-dark:   #0369a1;
    --danger:         #ef4444;
    --success:        #10b981;
    --pink:           #f43f8e;
    --bg:             #e2e8f0; /* Soft steel blue background */
    --surface:        #ffffff;
    --surface2:       #f1f5f9;
    --card-bg:        rgba(255, 255, 255, 0.9);
    --text:           #1e293b; /* Dark slate text */
    --muted:          #475569;
    --border:         rgba(0, 0, 0, 0.08);
    --radius:         14px;
    --header-h:       110px;
    --search-h:       60px;
    --transition:     all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after {
    margin: 0; padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
    font-family: var(--font-main);
}

/* ---- Background blobs ---- */
.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
}

.blob-1 {
    width: 600px; height: 600px;
    top: -150px; left: -150px;
    background: radial-gradient(circle, rgba(2, 132, 199, 0.05) 0%, transparent 70%);
}

.blob-2 {
    width: 600px; height: 600px;
    bottom: -150px; right: -150px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.03) 0%, transparent 70%);
}

/* ================================================================
   STUDENT VIEW
   ================================================================ */

#student-view { display: flex; flex-direction: column; min-height: 100vh; }

/* Sticky main header */
.main-header {
    position: sticky;
    top: 0;
    z-index: 300;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    text-align: center;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    box-shadow: 0 4px 20px rgba(2, 132, 199, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo-img {
    height: 70px;
    width: auto;
    object-fit: contain;
    display: none; /* Hidden if no logo */
}

.logo-img.active {
    display: block;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.logo-small {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--pink);
    letter-spacing: 3px;
    text-transform: uppercase;
}

.logo-large {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
    line-height: 1.1;
}

/* Sticky search bar */
.search-sticky {
    position: sticky;
    top: var(--header-h);
    z-index: 290;
    background: rgba(226, 232, 240, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    height: var(--search-h);
    display: flex;
    align-items: center;
}

/* Search Group Layout */
.search-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    max-width: 900px; /* Increased to fit repo btn */
    margin: 0 auto;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.search-icon-fixed {
    font-size: 0.9rem;
    margin-right: 0.75rem;
    opacity: 0.5;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    padding: 10px 0;
    color: var(--text);
}

.search-group select {
    width: 130px;
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.search-input.search-input { /* Double class for specificity */
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    background: #ffffff !important;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: #0f172a !important; /* Force dark text */
    font-size: 0.95rem;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.search-input::placeholder { color: #94a3b8; }

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

/* Book grid */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 2rem 3rem;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 900px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .book-grid {
        grid-template-columns: 1fr;
    }
}

/* Book card */
.book-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 260px; /* Increased min-height for better presence */
    width: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.04);
}

.book-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(2, 132, 199, 0.15);
    background: #ffffff;
}

.book-card-layout {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.book-info { flex: 1; min-width: 0; }

.book-category {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.book-title {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 0.35rem;
    color: var(--text);
    word-break: break-word;
}

.book-author {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
}

input[type=text],
input[type=password],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.88rem;
    transition: var(--transition);
}

select option {
    background-color: #ffffff;
    color: #1e293b;
}

/* Spine label */
.spine-label {
    flex-shrink: 0;
    background: #fff;
    color: #000;
    border: 1.5px solid #333;
    border-radius: 4px;
    width: 85px; /* Increased from 72px */
    min-height: 110px;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    text-align: center;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    font-size: 0.65rem;
    overflow: hidden; /* Safety */
}

.spine-header {
    font-size: 0.4rem; /* Slightly smaller */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    border-bottom: 1px solid #333;
    padding-bottom: 0.2rem;
    margin-bottom: 0.25rem;
    line-height: 1.1;
    word-break: break-all; /* Ensure long words wrap */
}

.spine-content {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.7rem;
}

/* Book footer */
.book-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 0.65rem;
}

.status-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    border: 1px solid;
}

.status-available {
    background: rgba(16,185,129,0.1);
    color: var(--success);
    border-color: rgba(16,185,129,0.3);
}

.status-borrowed {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
    border-color: rgba(239,68,68,0.3);
}

/* ================================================================
   ADMIN VIEW
   ================================================================ */

#admin-view { display: flex; flex-direction: column; min-height: 100vh; }

/* Admin sticky topbar */
.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 300;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.7rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: 0 4px 20px rgba(2, 132, 199, 0.05);
}

.admin-topbar-left {}

.admin-brand {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--pink);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 1px;
}

.admin-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
}

.admin-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Admin content area */
.admin-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 2rem 2rem;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    background: transparent;
    border: none;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}

.tab-btn:hover {
    background: rgba(2, 132, 199, 0.05);
    color: var(--primary);
}

.tab-btn.active {
    background: rgba(2, 132, 199, 0.1);
    color: var(--primary);
}

/* Toolbar (search + last updated) */
.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.admin-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    flex: 1;
    max-width: 460px;
}

.admin-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 0.9rem;
}

.admin-search-input::placeholder { color: var(--muted); }

.last-update-text {
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
}

/* Table */
.table-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    flex: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Force fixed column widths */
}

th, td {
    padding: 1.25rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    word-wrap: break-word; /* Ensure text wraps within fixed width */
    word-break: break-word;
    vertical-align: top;
    font-size: 0.88rem;
}

td:last-child, th:last-child { white-space: nowrap; }

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.025); }

th {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface);
    user-select: none;
}

th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
.sort-icon { opacity: 0.4; font-size: 0.8rem; }

.tbl-actions { display: flex; gap: 0.4rem; }

.btn-icon {
    padding: 0.3rem 0.5rem;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    cursor: pointer;
    font-size: 0.82rem;
    transition: var(--transition);
    line-height: 1;
}

.btn-icon:hover { background: rgba(255,255,255,0.1); }
.btn-icon.del:hover { background: rgba(239,68,68,0.15); color: var(--danger); border-color: rgba(239,68,68,0.4); }

/* Admin footer bar */
.admin-footer-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 0;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.book-count-text {
    font-size: 0.8rem;
    color: var(--muted);
}

/* ================================================================
   SHARED BUTTONS
   ================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    width: 100%;
}

.btn-sm {
    padding: 0.42rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 8px;
    width: auto;
}

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

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99,102,241,0.4);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-ghost:hover { background: rgba(255,255,255,0.06); }

.btn-danger {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.4);
    color: var(--danger);
    width: auto;
}

.btn-danger:hover { background: rgba(239,68,68,0.2); }

/* ================================================================
   ADMIN TRIGGER (floating lock)
   ================================================================ */

.admin-trigger {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 400;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.45;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.admin-trigger:hover {
    opacity: 1;
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: scale(1.1);
}

/* ================================================================
   MODALS
   ================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-box {
    background: var(--surface2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px;
    padding: 1.75rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
    text-align: center;
}

.form-group { margin-bottom: 0.8rem; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
}

label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

input[type=text],
input[type=password],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: #ffffff; /* Brighter input for modals too */
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    color: #1e293b;
    font-size: 0.88rem;
    transition: var(--transition);
    -webkit-appearance: none;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

input::placeholder, select::placeholder { color: var(--muted); }

select option {
    background: #ffffff;
    color: #1e293b;
}

/* ================================================================
   ANIMATIONS
   ================================================================ */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeUp 0.4s ease forwards; }

/* ================================================================
   EMPTY STATE
   ================================================================ */

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state p { font-size: 0.95rem; }

/* Pagination Styles */
.admin-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.page-size-selector select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
}

.admin-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.pagination-info {
    font-size: 0.85rem;
    color: var(--muted);
}

.pagination-btns {
    display: flex;
    gap: 0.5rem;
}

.pagination-btns .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap; /* Prevent wrapping */
}

.status-available {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #10b98144;
}

.status-borrowed {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #ef444444;
}

/* Summary View Styles */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    background: #f8fafc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
}

.summary-detail-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.summary-box {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    min-height: 400px; /* Fixed height to match categories */
    display: flex;
    flex-direction: column;
}

.summary-box h4 {
    margin: 0 0 1.25rem 0;
    color: var(--text);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.recent-list-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.recent-item-row {
    display: flex;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.recent-item-row:last-child { border-bottom: none; }

.recent-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.recent-content { flex: 1; min-width: 0; }

.recent-title-small {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-info-small {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--muted);
}

.recent-tag {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--primary);
}

.summary-cat-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.cat-stat-item {
    margin-bottom: 1.25rem;
}

.cat-stat-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cat-stat-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

/* Detail Modal Styling */
.detail-modal-box {
    background: #ffffff !important;
    max-width: 480px !important;
    padding: 2.2rem !important;
    border-radius: 24px !important;
    border: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
    animation: punchyPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
    color: #1e293b;
}

@keyframes punchyPop {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(30px);
    }
    70% {
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.detail-header {
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.detail-header h2 {
    font-size: 1.6rem;
    font-family: var(--font-heading);
    color: #0f172a;
    line-height: 1.25;
    margin: 0.6rem 0;
    font-weight: 800;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.6px;
}

.detail-item span {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 600;
}

.cat-stat-progress {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 1s ease-out;
}

/* Footer Styles */
.app-footer {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 1.5rem;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.repo-btn {
    text-decoration: none;
    font-weight: 600;
    padding: 0 0.8rem;
    height: 42px; /* Matching search input height */
    border-radius: 12px;
    white-space: nowrap;
    flex: 0 0 auto;
    width: auto;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.repo-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

@media (max-width: 768px) {
    /* Header optimization */
    .main-header {
        padding: 0.75rem 1rem;
        height: auto;
        min-height: 70px;
        justify-content: flex-start;
        gap: 1rem;
    }
    .logo-img {
        height: 45px;
    }
    .logo-container {
        align-items: flex-start;
    }
    .logo-large {
        font-size: 1.1rem;
        letter-spacing: 0;
        line-height: 1.2;
        text-align: left;
    }
    .logo-small {
        font-size: 0.55rem;
        letter-spacing: 1.5px;
    }

    /* Search bar optimization */
    .search-sticky {
        height: auto;
        padding: 1rem;
        top: 0; 
        position: relative; 
    }
    .search-group { 
        flex-direction: column; 
        gap: 0.75rem;
    }
    .search-group select {
        width: 100%;
    }
    .search-input-wrapper {
        width: 100%;
    }
    .repo-btn { 
        width: 100%; 
    }

    /* Admin View Responsiveness */
    .admin-topbar {
        padding: 1rem;
        flex-direction: column;
        align-items: center;
        height: auto;
        gap: 1.25rem;
        text-align: center;
    }
    .admin-topbar-left {
        flex-direction: column;
        gap: 0.4rem;
    }
    .admin-topbar-right {
        justify-content: center;
        width: 100%;
        gap: 0.4rem;
    }
    .admin-topbar-right .btn {
        font-size: 0.72rem;
        padding: 0.4rem 0.6rem;
        flex: 1 1 calc(33% - 0.5rem);
        min-width: 90px;
    }

    .admin-content {
        padding: 0.75rem;
    }

    .admin-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.75rem;
        margin-bottom: 1.25rem;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        gap: 0.25rem;
        scrollbar-width: none;
        border-bottom: 2px solid var(--border);
    }
    .admin-tabs::-webkit-scrollbar { display: none; }

    .tab-btn {
        flex: 0 0 auto;
        padding: 0.5rem 0.8rem;
        font-size: 0.82rem;
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    .admin-toolbar-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    /* Table optimization */
    .table-wrap {
        margin: 0 -0.75rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    table {
        min-width: 850px; /* Ensure columns have space */
    }

    /* Modal responsiveness */
    .modal-box {
        padding: 1.5rem;
        width: 100%;
        max-width: calc(100% - 2rem) !important;
        margin: 1rem;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    /* Summary Dashboard */
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .summary-detail-row {
        grid-template-columns: 1fr;
    }
    .stat-card {
        padding: 1.25rem;
    }

    /* Pagination */
    .admin-pagination {
        flex-direction: column;
        gap: 1.25rem;
        text-align: center;
        padding: 1.25rem 1rem;
    }
    .pagination-btns {
        width: 100%;
        justify-content: center;
    }
    .pagination-btns .btn {
        flex: 1;
    }

    .container {
        padding: 1rem;
    }
    .book-grid {
        grid-template-columns: 1fr;
    }
    .book-card-layout {
        flex-direction: row; 
        gap: 0.75rem;
    }
    .spine-label {
        transform: scale(0.8);
        transform-origin: right top;
        margin-left: -20px;
    }
}
