/* =============================================
   STIE LM DIGITAL LIBRARY - STYLES
   ============================================= */

/* ----- RESET & BASE ----- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh;
    color: #0f172a;
    position: relative;
    overflow-x: hidden;
    background: url('https://images.unsplash.com/photo-1448375240586-882707db888b?q=80&w=2070&auto=format&fit=crop') no-repeat center center fixed;
    background-size: cover;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.82) 0%, rgba(30, 41, 59, 0.75) 50%, rgba(15, 23, 42, 0.85) 100%);
    backdrop-filter: blur(2px);
    z-index: -2;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 25%, rgba(59, 130, 246, 0.18), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(167, 139, 250, 0.15), transparent 45%),
        radial-gradient(circle at 75% 80%, rgba(236, 72, 153, 0.12), transparent 45%),
        radial-gradient(circle at 20% 85%, rgba(16, 185, 129, 0.12), transparent 45%);
    z-index: -1;
    pointer-events: none;
    animation: auroraShift 20s ease-in-out infinite;
}

@keyframes auroraShift {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.05); }
}

/* ----- HEADER ----- */
.header-sticky { position: sticky; top: 0; z-index: 100; }

.header-gradient {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
    padding: 16px 0;
}

.header-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 50%),
        radial-gradient(circle at 85% 50%, rgba(167, 139, 250, 0.12), transparent 50%);
    pointer-events: none;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

/* ----- LOGO ----- */
.header-left { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.logo-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
}
.logo-icon-wrapper:hover { transform: scale(1.05); border-color: rgba(59, 130, 246, 0.4); }
.logo-icon-wrapper img { width: 100%; height: 100%; object-fit: cover; }

.header-title-group { display: flex; flex-direction: column; }
.header-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.gradient-text {
    background: linear-gradient(135deg, #ffffff 0%, #93c5fd 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle { font-size: 10px; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: rgba(148, 163, 184, 0.8); margin-top: 1px; }
.header-credit { font-size: 9px; font-weight: 500; color: rgba(148, 163, 184, 0.5); letter-spacing: 0.02em; }
.header-credit span { color: rgba(191, 219, 254, 0.7); font-weight: 600; }

/* ----- SEARCH BAR ----- */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 0 16px;
    max-width: 500px;
    margin: 0 auto;
}

.header-search-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 40px;
    padding: 4px 4px 4px 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.header-search-bar:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15), 0 4px 20px rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.95);
}
.header-search-bar input {
    flex: 1;
    border: none;
    outline: none;
    padding: 7px 0;
    font-size: 0.8rem;
    background: transparent;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #0f172a;
    min-width: 0;
}
.header-search-bar input::placeholder { color: #94a3b8; font-weight: 400; }
.header-search-bar .search-icon { color: #94a3b8; font-size: 0.85rem; margin-right: 6px; flex-shrink: 0; }
.header-search-bar .clear-btn {
    background: #f1f5f9;
    border: none;
    border-radius: 30px;
    padding: 5px 12px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}
.header-search-bar .clear-btn:hover { background: #e2e8f0; color: #0f172a; }

/* ----- HEADER RIGHT ----- */
.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.count-badge {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(167, 139, 250, 0.15));
    border: 1px solid rgba(96, 165, 250, 0.25);
    padding: 6px 12px;
    border-radius: 40px;
    font-size: 11px;
    font-weight: 700;
    color: #bfdbfe;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.count-badge .badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #60a5fa;
    box-shadow: 0 0 8px #60a5fa;
    animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 40px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Plus Jakarta Sans', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    letter-spacing: 0.01em;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.header-btn .btn-icon { font-size: 13px; line-height: 1; }

.header-btn-tools {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(167, 139, 250, 0.3));
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.2);
}
.header-btn-tools:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.5), rgba(167, 139, 250, 0.5));
    border-color: rgba(255, 255, 255, 0.3);
}

.header-btn-admin { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.08); }
.header-btn-admin:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }

.header-btn-logout { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.15); color: rgba(252, 165, 165, 0.9); }
.header-btn-logout:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.3); transform: translateY(-2px); }

.header-divider { width: 1px; height: 24px; background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.1), transparent); margin: 0 2px; }

/* ----- TOP BAR: Tabs + Clock ----- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 8px auto 0 auto;
    padding: 0 20px 6px 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.tab-switcher {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 40px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    flex-wrap: wrap;
}

.tab-switcher .tab-btn {
    padding: 8px 18px;
    border-radius: 30px;
    border: none;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.02em;
}
.tab-switcher .tab-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}
.tab-switcher .tab-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(167, 139, 250, 0.3));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}
.tab-switcher .tab-btn .badge {
    background: rgba(59, 130, 246, 0.3);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 9px;
    margin-left: 4px;
    color: #93c5fd;
}

/* ----- CLOCK ----- */
.clock-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 40px;
    padding: 4px 18px 4px 12px;
    flex-shrink: 0;
    position: relative;
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.clock-modern::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 40px;
    padding: 2px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899, #f59e0b, #10b981, #3b82f6);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    animation: borderFlow 4s linear infinite;
    z-index: 0;
}
.clock-modern > * { position: relative; z-index: 1; }

@keyframes borderFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.clock-modern .clock-icon-wrap {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(167, 139, 250, 0.25));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.clock-modern .clock-icon-wrap svg {
    width: 16px;
    height: 16px;
    color: #93c5fd;
    filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.3));
}
.clock-modern .clock-info { display: flex; flex-direction: column; line-height: 1.1; }
.clock-modern .clock-time {
    font-size: 16px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #93c5fd 50%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}
.clock-modern .clock-time .seconds {
    font-size: 11px;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.5);
    -webkit-text-fill-color: rgba(148, 163, 184, 0.5);
}
.clock-modern .clock-date {
    font-size: 9px;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.6);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ----- BOOK GRID ----- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 28px;
    padding: 8px;
}

.book-card {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 14px;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: visible;
}
.book-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 21px;
    padding: 2.5px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899, #f59e0b, #10b981, #3b82f6);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease, box-shadow 0.4s ease;
    z-index: 1;
    pointer-events: none;
    animation: borderFlow 5s linear infinite;
}
.book-card:hover::before { opacity: 1; box-shadow: 0 0 20px rgba(59, 130, 246, 0.15); }
.book-card:hover { transform: translateY(-8px); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2); }
.book-card:hover .book-thumbnail { transform: scale(1.03); }
.book-card > * { position: relative; z-index: 2; }

.book-thumbnail {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 14px;
    margin-bottom: 12px;
    background: #f1f5f9;
    border: 1px solid #e8edf2;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.book-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #0f172a;
    line-height: 1.4;
    margin-bottom: 4px;
    word-wrap: break-word;
}
.book-author {
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.2em;
    line-height: 1.4;
}
.book-size {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 6px;
    flex-shrink: 0;
    font-weight: 600;
}

/* ----- GOOGLE BOOKS CARD ----- */
.google-book-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    display: flex;
    gap: 16px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.google-book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}
.google-book-card .cover {
    width: 90px;
    height: 130px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.google-book-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.google-book-card .info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.google-book-card .info .title {
    color: #0f172a;
    font-weight: 700;
    font-size: 15px;
    line-height: 1.3;
    margin-bottom: 2px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.google-book-card .info .author {
    color: #3b82f6;
    font-size: 12px;
    font-weight: 600;
}
.google-book-card .info .meta {
    color: #64748b;
    font-size: 11px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.google-book-card .info .meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.google-book-card .info .description {
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.google-book-card .actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.google-book-card .actions button {
    padding: 8px 14px;
    border-radius: 40px;
    border: none;
    font-weight: 700;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
    white-space: nowrap;
}
.google-book-card .actions .btn-preview {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
}
.google-book-card .actions .btn-preview:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}
.google-book-card .actions .btn-info {
    background: #f1f5f9;
    color: #475569;
}
.google-book-card .actions .btn-info:hover {
    background: #e2e8f0;
}

/* ----- FILTER BAR ----- */
.filter-bar {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 14px 18px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 120px;
}

.filter-group label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}
.filter-group input:focus,
.filter-group select:focus {
    border-color: #3b82f6;
    background: rgba(255, 255, 255, 0.12);
}
.filter-group select option {
    background: #1e293b;
    color: white;
}
.filter-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.filter-btn-apply {
    padding: 9px 20px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}
.filter-btn-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}
.filter-btn-reset {
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.filter-btn-reset:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ----- TRANSLATOR FAB ----- */
.translator-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
    z-index: 10003;
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.15);
}
.translator-fab:hover { transform: scale(1.08); }
.translator-fab svg { width: 22px; height: 22px; color: white; }
.translator-fab.active { background: linear-gradient(135deg, #ef4444, #dc2626); }

.translator-panel {
    display: none;
    position: fixed;
    bottom: 85px;
    right: 24px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: rgba(15, 23, 42, 0.93);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
    z-index: 10003;
    padding: 16px;
    flex-direction: column;
    max-height: 60vh;
}
.translator-panel.active { display: flex; animation: popupIn 0.25s ease; }

.translator-panel .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.translator-panel .header span {
    font-weight: 700;
    font-size: 13px;
    color: white;
    display: flex;
    align-items: center;
    gap: 6px;
}
.translator-panel .header button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
}
.translator-panel .header button:hover { color: white; }

.translator-panel .lang-selector {
    margin: 6px 0 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.06);
    flex-wrap: wrap;
}
.translator-panel .lang-selector .lang-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.translator-panel .lang-selector .lang-label {
    font-size: 8px;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.translator-panel .lang-selector select {
    padding: 3px 8px 3px 6px;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: white;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 18px;
    text-align: center;
    min-width: 80px;
}
.translator-panel .lang-selector select option {
    background: #1e293b;
    color: white;
    text-align: center;
}
.translator-panel .lang-selector .swap-btn {
    background: rgba(255,255,255,0.05);
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
}
.translator-panel .lang-selector .swap-btn:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    transform: rotate(180deg);
}

.translator-panel textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: white;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
    max-height: 100px;
    outline: none;
    transition: border 0.2s;
}
.translator-panel textarea:focus { border-color: #3b82f6; }
.translator-panel textarea::placeholder { color: rgba(255,255,255,0.25); }

.translator-panel .output {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.5;
    min-height: 40px;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,0.4);
}
.translator-panel .output.loading { color: #94a3b8; font-style: italic; }
.translator-panel .output.has-result { color: #e2e8f0; align-items: flex-start; }

/* ----- MODALS ----- */
.book-viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
}
.book-viewer-frame {
    width: 100vw;
    height: 100vh;
    border: none;
    background: #000;
}

.book-viewer-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10002;
    display: flex;
    gap: 10px;
    align-items: center;
}
.viewer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Plus Jakarta Sans', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.viewer-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.viewer-btn .btn-label { font-size: 11px; font-weight: 600; }
.viewer-btn-close { background: rgba(239, 68, 68, 0.3); border-color: rgba(239, 68, 68, 0.3); padding: 12px 20px; }
.viewer-btn-close:hover { background: rgba(239, 68, 68, 0.5); }

.ai-popup-overlay,
.confirm-modal-overlay,
.tools-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.ai-popup-overlay.active,
.confirm-modal-overlay.active,
.tools-popup-overlay.active { display: flex; }

.ai-popup {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 640px;
    height: 78vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    animation: popupIn 0.3s ease;
}
@keyframes popupIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.ai-popup-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #f8fafc;
}
.ai-popup-header .title {
    font-weight: 800;
    font-size: 1.1rem;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-popup-close {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
}
.ai-popup-close:hover { background: #f1f5f9; color: #0f172a; }

.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}
.ai-chat-input {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}
.ai-chat-input input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.2s;
}
.ai-chat-input input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.ai-chat-input button {
    background: linear-gradient(135deg, #0f172a, #334155);
    border: none;
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: white;
    flex-shrink: 0;
}
.ai-chat-input button:hover { transform: scale(1.05); background: #0f172a; }

.message { display: flex; max-width: 85%; }
.message.user { align-self: flex-end; justify-content: flex-end; }
.message.ai { align-self: flex-start; }
.bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.user .bubble {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: white;
    border-bottom-right-radius: 4px;
}
.ai .bubble {
    background: white;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    width: fit-content;
    border: 1px solid #e2e8f0;
}
.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: pulse 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse {
    0%, 60%, 100% { transform: scale(0.8); opacity: 0.5; }
    30% { transform: scale(1.2); opacity: 1; }
}

/* ----- TOOLS POPUP ----- */
.tools-popup-modal {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    animation: popupIn 0.3s ease;
}
.tools-popup-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}
.tools-popup-header h3 {
    font-weight: 800;
    font-size: 1.2rem;
    color: #0f172a;
}
.tools-popup-close {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
}
.tools-popup-close:hover { background: #f1f5f9; color: #0f172a; }
.tools-popup-body {
    padding: 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
}
.tool-category {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.category-title {
    font-size: 12px;
    font-weight: 800;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}
.category-title .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot-ai { background: #3b82f6; }
.dot-pdf { background: #fb923c; }
.dot-citation { background: #34d399; }
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.tool-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 10px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.tool-grid-item:hover {
    background: white;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}
.tool-grid-item .icon { font-size: 24px; }
.tool-grid-item .name {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    text-align: center;
    line-height: 1.3;
}

/* ----- CONFIRM MODAL ----- */
.confirm-modal {
    background: white;
    border-radius: 24px;
    padding: 32px 28px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
    animation: popupIn 0.3s ease;
}

/* ----- FOOTER ----- */
.main-footer {
    margin-top: 48px;
    text-align: center;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 24px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px 16px 0 0;
}
.main-footer span { color: rgba(191, 219, 254, 0.8); font-weight: 700; }

/* ----- STATUS / EMPTY STATES ----- */
.book-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    gap: 12px;
    grid-column: 1/-1;
}
.book-empty {
    text-align: center;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.7);
    grid-column: 1/-1;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}
.book-empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
    color: white;
}
.book-empty h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}
.book-empty p { color: rgba(255, 255, 255, 0.6); }

.google-status {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 40px 20px;
    font-weight: 500;
    font-size: 14px;
}
.google-status .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}
.google-search-hint {
    color: rgba(255, 255, 255, 0.3);
    font-size: 11px;
    text-align: center;
    padding: 8px;
    font-weight: 500;
    margin-top: 4px;
}
.google-search-hint kbd {
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    font-family: inherit;
}

/* ----- RESPONSIVE ----- */
@media (max-width: 768px) {
    .header-inner { flex-wrap: wrap; gap: 10px; padding: 0 16px; }
    .header-left { flex: 0 0 auto; }
    .header-center { flex: 1 1 100%; order: 3; padding: 0; max-width: 100%; }
    .logo-icon-wrapper { width: 44px; height: 44px; }
    .header-title { font-size: 1.1rem; }
    .header-subtitle { font-size: 8px; }
    .header-credit { display: none; }
    .header-right { flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
    .count-badge { padding: 4px 10px; font-size: 10px; }
    .header-btn { padding: 5px 10px; font-size: 10px; }
    .header-btn .btn-label { display: none; }
    .header-btn .btn-icon { font-size: 14px; }
    .header-divider { display: none; }
    .top-bar { flex-direction: column; align-items: stretch; gap: 8px; }
    .tab-switcher { justify-content: center; }
    .clock-modern { align-self: center; }
    .google-book-card { flex-direction: column; }
    .google-book-card .cover { width: 100%; height: 180px; }
    .google-book-card .actions { flex-direction: row; }
    .google-book-card .actions button { flex: 1; }
    .filter-bar { flex-direction: column; }
    .filter-group { min-width: 100%; }
    .translator-panel { bottom: 76px; right: 12px; left: 12px; width: auto; padding: 14px; }
    .translator-fab { bottom: 16px; right: 16px; width: 44px; height: 44px; }
    .translator-panel .lang-selector select { min-width: 60px; font-size: 10px; }
}

@media (max-width: 640px) {
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px; padding: 4px; }
    .book-title { font-size: 0.8rem; }
    .tools-popup-body { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
    .book-viewer-controls { top: 12px; right: 12px; gap: 6px; }
    .viewer-btn { padding: 8px 14px; border-radius: 10px; }
    .viewer-btn .btn-label { display: none; }
    .tab-switcher .tab-btn { font-size: 10px; padding: 6px 12px; }
    .filter-btn-apply, .filter-btn-reset { width: 100%; }
}
