/* ============================================================
   Orthodox Catechesis — Custom Styles
   ============================================================ */

/* ── Global ─────────────────────────────────────────────── */
html, body {
    height: 100%;
}
body {
    display: flex;
    flex-direction: column;
    background-color: #fafaf8;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
main {
    flex: 1;
}

/* ── Activity cards ─────────────────────────────────────── */
.activity-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.activity-card:hover,
.activity-card:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.activity-card .card-img-top {
    height: 180px;
    object-fit: cover;
}
.activity-card .card-img-placeholder {
    height: 180px;
    background: linear-gradient(135deg, #c8a96a 0%, #8b5e3c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

/* ── Hotspot viewer ─────────────────────────────────────── */
.hotspot-container {
    position: relative;
    display: inline-block;
    width: 100%;
    line-height: 0;
}
.hotspot-container img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    display: block;
}

/* Hotspot pin button */
.hotspot-pin {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: #dc3545;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
    transition: transform 0.15s ease, background-color 0.15s ease;
    z-index: 10;
    /* Reset button defaults */
    padding: 0;
    line-height: 1;
}
.hotspot-pin:hover,
.hotspot-pin:focus {
    background-color: #b02a37;
    transform: translate(-50%, -50%) scale(1.25);
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

/* Pulse animation for discoverability */
@keyframes pinPulse {
    0%   { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.6); }
    70%  { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
.hotspot-pin {
    animation: pinPulse 2.5s infinite;
}
.hotspot-pin:hover,
.hotspot-pin:focus {
    animation: none;
}

/* Hotspot modal/popover panel */
.hotspot-panel {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
    padding: 1.25rem 1.5rem;
    position: relative;
}
.hotspot-panel .hotspot-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

/* ── Slide viewer ───────────────────────────────────────── */
.slide-card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
    overflow: hidden;
}
.slide-image-wrapper {
    background: #f0ede8;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slide-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}
.slide-body {
    padding: 1.25rem 1.5rem 1rem;
    font-size: 1.15rem;
    font-style: italic;
    line-height: 1.65;
    text-align: center;
    color: #2c2c2c;
    margin: 0;
}
.slide-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    border: 2px solid #adb5bd;
    background-color: #fff;
    padding: 0;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.slide-dot.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    transform: scale(1.35);
}
.slide-dot:hover:not(.active) {
    border-color: #6ea8fe;
    background-color: #cfe2ff;
}

/* ── Quiz engine ────────────────────────────────────────── */
.quiz-choice {
    border: 2px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
    background: #fff;
    text-align: left;
    width: 100%;
    display: block;
    color: #212529;
}
.quiz-choice:hover:not(:disabled) {
    border-color: #0d6efd;
    background-color: #f0f4ff;
}
.quiz-choice.selected {
    border-color: #0d6efd;
    background-color: #e7f0ff;
}
.quiz-choice.correct {
    border-color: #198754;
    background-color: #d1e7dd;
    color: #0a3622;
}
.quiz-choice.incorrect {
    border-color: #dc3545;
    background-color: #f8d7da;
    color: #58151c;
}
.quiz-choice:disabled {
    cursor: default;
    opacity: 1;
}

/* Progress bar */
.quiz-progress {
    height: 0.5rem;
    border-radius: 0.25rem;
    overflow: hidden;
    background-color: #dee2e6;
}
.quiz-progress-fill {
    height: 100%;
    background-color: #0d6efd;
    transition: width 0.3s ease;
    border-radius: 0.25rem;
}

/* Score / result display */
.score-circle {
    width: 6rem;
    height: 6rem;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: bold;
    margin: 0 auto 1rem;
    border: 4px solid currentColor;
}
.score-circle.excellent { color: #198754; border-color: #198754; background-color: #d1e7dd; }
.score-circle.good      { color: #0d6efd; border-color: #0d6efd; background-color: #cfe2ff; }
.score-circle.low       { color: #dc3545; border-color: #dc3545; background-color: #f8d7da; }

/* ── Phase tabs ─────────────────────────────────────────── */
.phase-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.phase-tab {
    flex: 1;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    border: 2px solid #dee2e6;
    background: #fff;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
    text-align: center;
}
.phase-tab.active {
    border-color: #0d6efd;
    background-color: #0d6efd;
    color: #fff;
}
.phase-tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Landing page ────────────────────────────────────────── */
.landing-hero {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a237e 0%, #4a148c 50%, #880e4f 100%);
    color: #fff;
    text-align: center;
}
.lang-btn {
    width: 10rem;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 0.75rem;
    transition: transform 0.15s;
}
.lang-btn:hover {
    transform: scale(1.05);
}

/* ── Activity table ──────────────────────────────────────── */
.activity-table {
    margin-bottom: 2rem;
    border-collapse: separate;
    border-spacing: 0;
}

.activity-table thead {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.activity-table th {
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border: none;
}

.activity-table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #dee2e6;
}

.activity-table tbody tr {
    transition: background-color 0.15s;
}

.activity-table tbody tr:hover {
    background-color: #f8f9fa;
}

.table-date {
    width: 15%;
    color: #6c757d;
    font-size: 0.95rem;
}

.table-theme {
    flex-grow: 1;
}

.activity-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
}

.activity-link:hover {
    text-decoration: underline;
}

.activity-text {
    color: #495057;
    font-weight: 500;
}

.table-download,
.table-quiz {
    width: auto;
    white-space: nowrap;
}

/* Button spacing in table */
.activity-table .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

/* Mobile: Stack table into card-like rows */
@media (max-width: 767px) {
    .activity-table {
        display: block;
        border: none;
    }

    .activity-table thead {
        display: none;
    }

    .activity-table tbody {
        display: block;
    }

    .activity-table tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        border: 1px solid #dee2e6;
        border-radius: 0.5rem;
        overflow: hidden;
    }

    .activity-table td {
        display: block;
        padding: 0.75rem;
        border: none;
        border-bottom: 1px solid #e9ecef;
    }

    .activity-table td:last-child {
        border-bottom: none;
    }

    .table-date {
        width: auto;
    }

    .activity-link {
        display: block;
    }
}

/* ── PDF viewer ──────────────────────────────────────────── */
.pdf-viewer {
    width: 100%;
    max-width: 900px;
    margin: 1.5rem auto;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.pdf-viewer embed {
    width: 100%;
    aspect-ratio: 8.5 / 11;
    max-height: 90vh;
    display: block;
}

/* Mobile — reduce max-height */
@media (max-width: 768px) {
    .pdf-viewer embed {
        max-height: 70vh;
    }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 576px) {
    .hotspot-pin {
        width: 1.6rem;
        height: 1.6rem;
        font-size: 0.6rem;
    }
    .activity-card .card-img-top,
    .activity-card .card-img-placeholder {
        height: 130px;
    }
}

/* ── Accessibility ───────────────────────────────────────── */
:focus-visible {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    clip: rect(0,0,0,0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}
