/* ===================================================================
   Photo Club Judging Tracker – Stylesheet
   =================================================================== */

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

:root {
    --primary: #2c3e50;
    --primary-light: #3498db;
    --accent: #e74c3c;
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --border: #dcdde1;
    --past-bg: #f9f9f9;
    --future-bg: #eaf6ff;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --radius: 6px;
}

html { font-size: 15px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Container ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.2rem 1.5rem;
}

/* ---------- Page title ---------- */
.page-title {
    font-size: 1.6rem;
    margin-bottom: 1rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.btn-primary { background: var(--primary-light); color: #fff; }
.btn-primary:hover { background: #2980b9; }
.btn-secondary { background: #bdc3c7; color: var(--text); }
.btn-secondary:hover { background: #95a5a6; color: #fff; }
.btn-danger { background: var(--accent); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-sm { padding: 0.25rem 0.65rem; font-size: 0.8rem; }
.btn-back { margin-bottom: 1rem; }

/* ---------- Forms ---------- */
label {
    display: block;
    font-weight: 600;
    margin: 0.8rem 0 0.25rem;
    font-size: 0.9rem;
}
input[type="text"],
input[type="password"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.7rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    font-family: inherit;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}
.form-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 1.2rem;
}

/* ---------- Flash / Error ---------- */
.flash-messages { margin-bottom: 1rem; }
.flash {
    background: #dff0d8;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
}
.error-msg {
    background: #f2dede;
    color: #a94442;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

/* ---------- Login ---------- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}
.login-box {
    background: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.login-box h1 { font-size: 1.4rem; margin-bottom: 0.2rem; }
.login-box h2 { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.2rem; font-weight: 400; }
.login-box .btn { width: 100%; margin-top: 1rem; }

/* ---------- Data table ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    background: var(--primary);
    color: #fff;
    padding: 0.55rem 0.7rem;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}
.data-table td {
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.data-table .center { text-align: center; }

.past-judging { background: var(--past-bg); }
.future-judging { background: var(--future-bg); }

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #d5e8f7 !important; }
.clickable-row.selected { background: #bdd8ee !important; }

/* ---------- Comments / Feedback ellipsis ---------- */
.comments-cell,
.feedback-cell {
    max-width: 220px;
    cursor: pointer;
}
.ellipsis-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Schedule list (scrollable, 85vh) ---------- */
.schedule-list {
    height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
}
.schedule-toolbar { margin-bottom: 0.8rem; }

/* ---------- Actions cell ---------- */
.actions-cell {
    white-space: nowrap;
}
.actions-cell .btn { margin-right: 0.3rem; }

/* ---------- Modal ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 500;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }

.modal-dialog {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    width: 480px;
    max-width: 92vw;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-sm { width: 400px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}
.modal-body { padding: 1.2rem; }

/* ---------- Reaction page ---------- */
.judging-info-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}
.info-row { margin-bottom: 0.35rem; }

.reaction-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.reaction-form h2 { font-size: 1.2rem; margin-bottom: 0.8rem; }

.score-options {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0.8rem 0 1rem;
}
.score-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 0.6rem 0.9rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s, background 0.2s;
    min-width: 90px;
}
.score-label:hover { border-color: var(--primary-light); }
.score-label input[type="radio"] { display: none; }
.score-label input[type="radio"]:checked + .score-badge { transform: scale(1.2); }
.score-label:has(input:checked) {
    border-color: var(--primary-light);
    background: rgba(52,152,219,0.08);
}
.score-badge {
    font-size: 1.5rem;
    font-weight: 700;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 0.3rem;
    transition: transform 0.15s;
}
.score-1 { background: #e74c3c; }
.score-2 { background: #e67e22; }
.score-3 { background: #f1c40f; color: #333; }
.score-4 { background: #2ecc71; }
.score-5 { background: #3498db; }
.score-6 { background: #9b59b6; }
.score-text { font-size: 0.75rem; color: var(--text-muted); }

.already-voted {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.already-voted h2 { color: var(--primary-light); margin-bottom: 0.5rem; }

/* ---------- Reaction closed page ---------- */
.closed-info-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 600px;
}
.closed-info-card h2 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.info-section { margin-bottom: 1rem; }
.info-section p { margin-bottom: 0.3rem; }
.muted { color: var(--text-muted); font-style: italic; }
.highlight { color: var(--primary-light); font-weight: 600; }

/* ---------- Thanks ---------- */
.thanks-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}
.thanks-box {
    text-align: center;
    background: var(--card-bg);
    padding: 3rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.thanks-box h1 { color: var(--primary-light); margin-bottom: 0.5rem; }
.thanks-box p { margin-bottom: 1.5rem; }

/* ---------- Review page ---------- */
.review-top {
    height: 25vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    margin-bottom: 1rem;
}
.review-bottom {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
}
.review-detail {
    display: flex;
    min-height: 0;
}
.review-sidebar {
    width: 200px;
    min-width: 200px;
    padding: 1rem;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    max-height: calc(75vh - 25vh - 4rem);
}
.review-sidebar hr { margin: 0.8rem 0; border: 0; border-top: 1px solid var(--border); }
.sidebar-section p { font-size: 0.85rem; margin-bottom: 0.3rem; }
.judge-link {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 0.5rem;
}
.review-reactions {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    max-height: calc(75vh - 25vh - 4rem);
}
.review-reactions h3 { margin-bottom: 0.6rem; }

/* ---------- Analysis page ---------- */
.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}
.chart-container h2 { font-size: 1.1rem; margin-bottom: 0.8rem; }

.analysis-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.analysis-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.analysis-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    background: var(--primary);
    color: #fff;
}
.analysis-card-header h3 { font-size: 1rem; }
.badge {
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}
.analysis-card-body {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    align-items: flex-start;
}
.analysis-stats { flex: 1; }
.analysis-stats p { font-size: 0.88rem; margin-bottom: 0.3rem; }
.analysis-pie {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
    .score-options { justify-content: center; }
    .review-detail { flex-direction: column; }
    .review-sidebar { width: 100%; min-width: auto; border-right: none; border-bottom: 1px solid var(--border); }
    .analysis-card-body { flex-direction: column; align-items: center; }
}
