/* CIS-Haifa design system — ported from old_site/index.php (primary design language).
   RTL Hebrew, blue primary + red accent, Rubik font, class-based dark mode. */

@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap');

:root {
    --primary: #0664aa; /* Haifa blue */
    --primary-hover: #054b7f;
    --accent: #d51111; /* red */
    --bg: #f2f2f2;
    --card: #ffffff;
    --text: #303030;
    --muted: #6b7280;
    --border: #a6a8a9;
    --shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
    --radius: 12px;
}

body.dark-mode {
    --bg: #0f172a;
    --card: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: rgba(255, 255, 255, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Rubik, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    text-align: center;
    transition: background-color 0.3s, color 0.3s;
}

/* ---- Shared header (blue bar + thin red bottom border) — reused across every page ----
   Title + icons sit in a fixed-height band and are VERTICALLY CENTERED within it. The news
   marquee (homepage only) is an absolute strip at the bottom; pages that have it get extra
   height so the centered title stays above it. */
.app-header {
    --header-band: 56px;
    background: var(--primary);
    color: #ebf8ff;
    font-size: 22px;
    font-weight: 700;
    position: relative;
    min-height: var(--header-band);
    padding: 0 24px;
    border-bottom: 4px solid var(--accent);
}
.app-header:has(.marquee) {
    min-height: calc(var(--header-band) + 28px);
}

.app-header .header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    height: var(--header-band);
    display: flex;
    align-items: center;
    text-align: center;
    line-height: 1.15;
}

.app-header .header-icons-left,
.app-header .header-icons-right {
    display: flex;
    align-items: center;
    gap: 14px;
    position: absolute;
    top: 0;
    height: var(--header-band);
}
.app-header .header-icons-left {
    inset-inline-start: 20px;
}
.app-header .header-icons-right {
    inset-inline-end: 20px;
}

.header-icon {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%; /* circular logoranker.png fits the round slot */
    cursor: pointer;
    transition: transform 0.2s ease;
}
.header-icon:hover {
    transform: scale(1.12);
}

/* ---- Materials-request panel (homepage banner, item 29) ---- */
.materials-panel {
    max-width: 1000px;
    margin: 16px auto 0;
    padding: 12px 18px;
    background: color-mix(in srgb, var(--accent) 12%, var(--card));
    border: 1px solid var(--accent);
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
}
.materials-panel a {
    color: var(--primary);
    font-weight: 700;
}

/* ---- Searchable dropdown (js/searchable-select.js) — themed combobox, item 19 ---- */
.ss-wrap {
    position: relative;
    display: inline-block;
}
.ss-pop {
    position: absolute;
    z-index: 50;
    inset-inline: 0;
    top: calc(100% + 2px);
    max-height: 260px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: right;
}
.ss-item {
    padding: 8px 12px;
    cursor: pointer;
    white-space: nowrap;
}
.ss-item:hover,
.ss-item.active {
    background: var(--primary);
    color: #fff;
}
.ss-empty {
    padding: 8px 12px;
    color: var(--muted);
}

.marquee {
    position: absolute;
    bottom: 4px;
    inset-inline: 0;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    font-size: 16px;
    font-weight: 600;
    color: #ebf8ff;
}

/* ---- Card grid (homepage + listings) ---- */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 24px;
    place-items: center;
}

.item,
.card {
    background: var(--card);
    color: var(--text);
    padding: 20px;
    border-radius: var(--radius);
    border: 1px solid rgba(6, 100, 170, 0.25);
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80%;
}
.item:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.14), 0 4px 10px rgba(0, 0, 0, 0.08);
    border-color: rgba(6, 100, 170, 0.45);
}
.item img {
    max-width: 80%;
}

/* ---- Buttons / forms ---- */
.btn {
    cursor: pointer;
    border: 2px solid var(--primary);
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    display: inline-block;
}
.btn:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn-outline {
    background: transparent;
    color: var(--primary);
}
.btn-danger {
    background: var(--accent);
    border-color: var(--accent);
}

.form-field {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: var(--card);
    color: var(--text);
}
.form-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(6, 100, 170, 0.25);
}

/* ---- Tables (grades, reports, admin) ---- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
}
.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: start;
}
.table th {
    background: var(--primary);
    color: #fff;
}

.page {
    padding: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

/* ---- Auth pages (login/register/forgot/reset/terms) ---- */
.auth-wrap {
    max-width: 440px;
    margin: 24px auto;
    padding: 0 16px;
}
.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 24px;
    text-align: center;
}
.round-big-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin-bottom: 12px;
    cursor: pointer;
}
.auth-card h1 {
    color: var(--primary);
    font-size: 1.6rem;
    margin: 8px 0 18px;
}
.auth-field {
    text-align: start;
    margin-bottom: 14px;
}
.auth-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}
.btn-green {
    background: #1c8a4d;
    border-color: #1c8a4d;
}
.btn-green:hover {
    background: #156c3c;
    border-color: #156c3c;
}
.btn-red {
    background: var(--accent);
    border-color: var(--accent);
}
.btn-red:hover {
    filter: brightness(0.9);
}
.auth-note {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 14px;
    text-align: start;
}
.auth-msg {
    margin-top: 14px;
    color: var(--primary);
}
.auth-msg.error {
    color: var(--accent);
}

/* modal (privacy/terms) */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    overflow-y: auto;
}
.modal-backdrop.open {
    display: block;
}
.modal-box {
    background: var(--card);
    color: var(--text);
    max-width: 650px;
    margin: 4% auto;
    padding: 2rem;
    border-radius: 10px;
    text-align: start;
    max-height: 84vh;
    overflow-y: auto;
}
.modal-box h2 {
    color: var(--primary);
    text-align: center;
}

/* ---- Donation button (heartbeat) — homepage ---- */
.donation-wrap {
    display: flex;
    justify-content: center;
    margin: 8px 0 32px;
}
.donation-icon {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    box-shadow: 0 0 12px rgba(213, 17, 17, 0.45);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.donation-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 0 16px rgba(213, 17, 17, 0.55);
}
@keyframes heartbeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.1); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.heartbeat {
    animation: heartbeat 1.5s infinite ease-in-out;
}

@media (max-width: 600px) {
    .container {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
    }
    .donation-icon {
        width: 80px;
        height: 80px;
    }
}
