/**
 * sheets_archive.css
 * Shared premium styling for the library "Google Sheets archive" pages
 * (ספרי לימוד, ספרי קריאה, תוכניות לשיפור השפה העברית).
 * Mirrors the brand language of pages/useful_info/protocols.html.
 */
:root {
    --primary: #004d99;
    --primary-dark: #003366;
    --primary-light: #e6f0fa;
    --accent: #ffb300;
    --accent-dark: #e09d00;
    --accent-light: #fff8e1;
    --bg-gray: #f8fafc;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(0,77,153,0.12);
    --radius-card: 20px;
    --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --glass: rgba(255, 255, 255, 0.85);
}

body {
    font-family: 'Rubik', sans-serif;
    background: #f8fafc;
    color: var(--text-dark);
}

/* Navbar */
.navbar {
    background: var(--glass) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.8rem 0 !important;
    transition: var(--transition);
    box-shadow: 0 2px 15px rgba(0,0,0,0.05);
}
.nav-icon-link {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5px 12px !important;
    transition: var(--transition);
    background: transparent !important;
    color: var(--text-dark) !important;
    text-decoration: none;
}
.nav-icon-link i { font-size: 1.3rem; margin-bottom: 4px; color: var(--primary); transition: color 0.2s ease; }
.nav-icon-link span { font-size: 0.68rem; line-height: 1; font-weight: 600; }
.nav-icon-link:hover { transform: scale(1.15); color: var(--accent) !important; }
.nav-icon-link:hover i { color: var(--accent); }

.navbar-user-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    border: 2px solid var(--primary); overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: white; transition: var(--transition);
}
.navbar-user-avatar:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.navbar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Breadcrumb */
.breadcrumb-bar { background: white; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.breadcrumb { margin-bottom: 0; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; font-weight: 600; }
.breadcrumb-item.active { color: var(--text-muted); font-weight: 500; }

/* Hero */
.hero-section {
    background: linear-gradient(135deg, #003366 0%, #004d99 50%, #0077cc 100%);
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
    color: white;
    padding: 85px 0 75px;
    text-align: center;
    border-bottom-left-radius: 40px;
    border-bottom-right-radius: 40px;
    box-shadow: 0 15px 30px rgba(0,77,153,0.12);
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -30%; left: -10%;
    width: 60%; height: 200%;
    background: radial-gradient(circle, rgba(255,179,0,0.08) 0%, transparent 70%);
    transform: rotate(-20deg);
    pointer-events: none;
}
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.hero-badge {
    background: rgba(255,179,0,0.18);
    border: 1.5px solid rgba(255,179,0,0.4);
    color: var(--accent);
    padding: 6px 18px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    animation: heroBadge 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.hero-title {
    font-family: 'Heebo', sans-serif;
    font-weight: 900;
    font-size: 3rem;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
    animation: heroSlideUp 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.15) both;
}
.hero-title .hero-keyword {
    background: linear-gradient(90deg, var(--accent), #ffe08a, var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: heroKeywordShine 4s linear infinite;
}
.hero-title-decor {
    width: 0; height: 4px; background: var(--accent);
    margin: 10px auto 0; border-radius: 2px;
    animation: heroDeco 0.8s 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.hero-desc {
    font-size: 1.2rem; max-width: 700px; margin: 0 auto; opacity: 0.95;
    animation: heroSlideUp 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.15) 0.15s both;
    line-height: 1.6;
}
@keyframes heroBadge {
    from { opacity: 0; transform: translateY(-15px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes heroSlideUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroDeco { to { width: 90px; } }
@keyframes heroKeywordShine { to { background-position: -200% center; } }

/* Toolbar */
.toolbar-wrapper {
    background: white; border-bottom: 1px solid rgba(0,77,153,0.06);
    padding: 14px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    margin-top: -30px; position: relative; z-index: 10;
    border-radius: 20px; max-width: 95%; margin-left: auto; margin-right: auto;
    margin-bottom: 30px;
}
.toolbar-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.toolbar-left  { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.btn-toolbar-action {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 50px; font-weight: 700; font-size: 0.85rem;
    border: 2px solid transparent; cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.btn-toolbar-reset { background: var(--bg-gray); color: var(--text-muted); border-color: rgba(100,116,139,0.2); }
.btn-toolbar-reset:hover { background: #e2e8f0; color: var(--text-dark); transform: translateY(-1px); }

.btn-toolbar-sort { background: var(--primary-light); color: var(--primary); border-color: rgba(0,77,153,0.15); }
.btn-toolbar-sort:hover { background: var(--primary); color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,77,153,0.2); }

.btn-toolbar-refresh { background: rgba(22,163,74,0.08); color: #16a34a; border-color: rgba(22,163,74,0.2); }
.btn-toolbar-refresh:hover { background: #16a34a; color: white; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(22,163,74,0.25); }
.btn-toolbar-refresh.spinning i { animation: spin 0.8s linear infinite; }
.btn-toolbar-refresh:disabled { opacity: 0.6; cursor: not-allowed; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-toolbar-select {
    background: white; border: 2px solid rgba(0,77,153,0.12); color: var(--text-dark);
    padding: 8px 16px; border-radius: 50px; font-weight: 700; font-size: 0.85rem;
    display: inline-flex; align-items: center; gap: 8px; transition: var(--transition);
    cursor: pointer;
}
.btn-toolbar-select:hover { background: var(--primary-light); color: var(--primary); transform: translateY(-1px); }

/* Search */
.search-wrapper { position: relative; display: flex; align-items: center; }
.search-input {
    width: 200px; padding: 7px 36px 7px 16px; border-radius: 50px;
    border: 2px solid rgba(0,77,153,0.12); font-size: 0.88rem; font-weight: 500;
    outline: none; transition: var(--transition);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 10px rgba(0,77,153,0.1); width: 260px; }
.search-icon { position: absolute; right: 14px; color: var(--text-muted); pointer-events: none; }

/* Year selector */
.year-select-btn {
    background: white; border: 2px solid rgba(0,77,153,0.2); color: var(--primary);
    padding: 8px 20px; border-radius: 50px; font-weight: 700; font-size: 0.85rem;
    display: inline-flex; align-items: center; gap: 8px; transition: var(--transition);
    cursor: pointer;
}
.year-select-btn:hover { background: var(--primary-light); transform: translateY(-1px); }
.year-select-btn i { color: var(--accent); }

.toolbar-dropdown .dropdown-menu {
    border: none; border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    padding: 8px; min-width: 180px;
}
.toolbar-dropdown .dropdown-item {
    border-radius: 10px; padding: 9px 14px; font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; gap: 8px; transition: background 0.2s;
    cursor: pointer;
}
.toolbar-dropdown .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.toolbar-dropdown .dropdown-item.active-year { background: var(--primary); color: white; }
.toolbar-dropdown .dropdown-item.active-sort { background: var(--primary-light); color: var(--primary); font-weight: 800; }
.toolbar-dropdown .dropdown-item.active-filter { background: var(--primary-light); color: var(--primary); font-weight: 800; }

/* Edit Mode Banner */
.edit-mode-banner {
    background: linear-gradient(135deg, #fff8e1, #fffbf0);
    border: 2px solid rgba(255,179,0,0.4); border-radius: 16px;
    padding: 16px 22px; margin-bottom: 24px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; animation: fadeIn 0.4s ease;
}
.edit-mode-banner .edit-info { display: flex; align-items: center; gap: 10px; color: #92400e; font-weight: 600; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* Stats */
.circular-stats { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: white; border: 1px solid rgba(0,77,153,0.08); border-radius: 50px;
    padding: 6px 16px; font-size: 0.85rem; font-weight: 700; color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.stat-chip i { color: var(--accent); }

.archive-label-banner {
    background: rgba(0,77,153,0.04); border-right: 4px solid var(--primary);
    padding: 10px 18px; border-radius: 8px; margin-bottom: 24px;
    font-weight: 700; font-size: 0.9rem; color: var(--primary);
    display: flex; align-items: center; gap: 8px;
}

/* Cards */
.doc-card {
    background: white; border-radius: var(--radius-card); padding: 25px;
    border: 1px solid rgba(0,77,153,0.08); box-shadow: var(--shadow-card);
    transition: var(--transition); position: relative; overflow: hidden;
    display: flex; flex-direction: column; height: 100%;
    animation: cardAppear 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
@keyframes cardAppear {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
.doc-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0,77,153,0.12);
    border-color: rgba(0,77,153,0.2);
}
.doc-card::before {
    content: ''; position: absolute; top: 0; right: 0;
    width: 5px; height: 100%; border-radius: 0 var(--radius-card) var(--radius-card) 0;
    background: var(--card-accent, var(--primary));
}

.doc-type-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px; font-size: 0.78rem;
    font-weight: 700; margin-bottom: 10px; width: fit-content;
}
.doc-meta-line { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.doc-meta-line i { color: var(--primary); width: 15px; flex-shrink: 0; }
.doc-title {
    font-family: 'Heebo', sans-serif; font-weight: 800; font-size: 1.12rem;
    color: var(--primary-dark); line-height: 1.4; margin-bottom: 10px;
}
.doc-subtitle { font-size: 0.88rem; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.doc-desc { font-size: 0.87rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.doc-meta { font-size: 0.82rem; color: var(--text-muted); display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-meta span { display: flex; align-items: center; gap: 5px; }
.doc-note {
    margin-top: auto; margin-bottom: 12px; padding: 9px 13px; background: var(--bg-gray);
    border-radius: 8px; font-size: 0.82rem; color: #475569;
    border-right: 3px solid var(--card-accent, var(--primary-light));
}
.doc-footer-row { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn-open-pdf {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px;
    background: var(--primary); color: white; border-radius: 30px;
    font-size: 0.88rem; font-weight: 700; text-decoration: none;
    transition: var(--transition); border: none; width: 100%;
}
.btn-open-pdf:hover { background: var(--primary-dark); color: white; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,77,153,0.2); }
.btn-open-pdf:active { transform: translateY(0); }

.doc-extra-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.doc-extra-link {
    font-size: 0.76rem; font-weight: 600; color: var(--primary); text-decoration: none;
    background: var(--primary-light); padding: 3px 10px; border-radius: 20px;
    display: inline-flex; align-items: center; gap: 4px; transition: var(--transition);
}
.doc-extra-link:hover { background: var(--primary); color: white; }

.card-year-tag {
    position: absolute; left: 0; top: 0;
    background: var(--primary-light); color: var(--primary);
    padding: 4px 14px; font-size: 0.72rem; font-weight: 800;
    border-bottom-right-radius: 12px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.03);
    border-right: 1px solid rgba(0,77,153,0.1);
    border-bottom: 1px solid rgba(0,77,153,0.1);
}

/* Favorites */
.fav-auto-host { position: absolute; left: 12px; top: 12px; z-index: 10; }
.fav-btn-standard {
    background: white !important;
    border: 1.5px solid rgba(100,116,139,0.15) !important;
    border-radius: 50% !important;
    width: 34px !important; height: 34px !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
    color: var(--text-muted) !important;
}
.fav-btn-standard:hover { color: var(--accent) !important; border-color: var(--accent) !important; transform: scale(1.1) !important; }
.fav-btn-standard.saved { color: var(--accent) !important; border-color: var(--accent) !important; background: var(--accent-light) !important; }
.fav-btn-standard:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Admin */
body:not(.edit-mode-active) .admin-cms-element { display: none !important; }
.admin-actions { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 9; }
.admin-actions button { border: 1px solid rgba(0,77,153,0.1); width: 32px; height: 32px; font-size: 0.85rem; display: flex; align-items: center; justify-content: center; }
.admin-actions button:hover { transform: scale(1.08); }

#cms-fab { position: fixed; bottom: 30px; left: 30px; z-index: 9999; }

/* Skeleton */
.skeleton-card {
    background: white; border-radius: var(--radius-card); padding: 25px;
    box-shadow: var(--shadow-card); border: 1px solid rgba(0,77,153,0.04);
    position: relative; overflow: hidden; height: 100%; display: flex; flex-direction: column; gap: 14px;
}
.skeleton-card::after {
    content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
    transform: translateX(-100%); animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton-line { height: 12px; background: #e2e8f0; border-radius: 6px; }
.skeleton-badge { width: 80px; height: 24px; border-radius: 20px; background: #e2e8f0; }
.skeleton-title { height: 20px; background: #e2e8f0; border-radius: 6px; width: 85%; }
.skeleton-btn { height: 38px; border-radius: 30px; background: #e2e8f0; width: 100%; margin-top: auto; }

/* State cards */
.state-card {
    background: white; border-radius: var(--radius-card); padding: 50px 30px;
    text-align: center; border: 1px dashed rgba(0,77,153,0.2);
    box-shadow: var(--shadow-card); margin: 30px auto; max-width: 500px;
    animation: fadeIn 0.4s ease;
}
.state-icon {
    width: 70px; height: 70px; border-radius: 50%;
    background: var(--bg-gray); display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px; font-size: 2rem; color: var(--text-muted);
}

/* Footer */
footer { background: #0f172a; color: #94a3b8; padding: 60px 0 30px; border-top: 5px solid var(--accent); }
.footer-logo { height: 50px; margin-bottom: 16px; }

/* Responsive */
@media (max-width: 991px) {
    .toolbar-inner { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { justify-content: center; width: 100%; }
    .search-input { width: 100%; }
    .search-input:focus { width: 100%; }
    .hero-title { font-size: 2.2rem; }
}
@media (max-width: 575px) {
    .toolbar-left { flex-direction: column; align-items: stretch; }
    .toolbar-left .dropdown, .toolbar-left .search-wrapper { width: 100%; }
    .btn-toolbar-select, .year-select-btn { width: 100%; justify-content: space-between; }
    .hero-title { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-delay: 0s !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
