/* =========================================
   Kdo má? Já mám! – hlavní stylesheet
   Paleta: papírově béžová, inkoustová tmavomodrá, červená akcent
   Font: Syne (display) + Space Mono (monospace)
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,600;1,400&family=DM+Sans:wght@400;500&display=swap');

:root {
    --ink:        #0f1f35;
    --ink-light:  #1e3a5f;
    --paper:      #f0f4f8;
    --paper-warm: #e4ecf4;
    --paper-dark: #ccd9e8;
    --red:        #d43209;   /* původně červená → námořní modrá */
    --red-light:  #2e86c1;   /* původně světle červená → světlejší modrá */
    --gold:       #b07d2a;   /* zlatá zůstává, jen o tón teplejší */
    --green:      #1a6b55;   /* přirozeně doplňující teal-zelená */
    --white:      #ffffff;
    --shadow:     rgba(15, 31, 53, 0.14);
    --shadow-lg:  rgba(15, 31, 53, 0.24);

    --font-display: 'Lora', serif;
    --font-mono:    'DM Sans', sans-serif;

    --radius:    4px;
    --radius-lg: 8px;
    --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-mono);
    background-color: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 27px,
            rgba(26,26,46,0.04) 27px,
            rgba(26,26,46,0.04) 28px
        );
}

/* ---- TYPOGRAFIE ---- */

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.1;
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }

p { line-height: 1.7; }

em { font-style: normal; color: var(--red); }

/* ---- LAYOUT ---- */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- NAVIGACE ---- */

.navbar {
    background: var(--ink);
    color: var(--paper);
    padding: 0.8rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid var(--red);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--paper);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.navbar-brand span { color: var(--red); }

.navbar-user {
    font-size: 0.75rem;
    color: var(--paper-dark);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-user strong { color: var(--paper); font-family: var(--font-display); }

.navbar-logout {
    color: var(--paper-dark);
    text-decoration: none;
    font-size: 0.75rem;
    border: 1px solid rgba(245,240,232,0.2);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius);
    transition: var(--transition);
}
.navbar-logout:hover { background: rgba(245,240,232,0.1); color: var(--paper); }

/* ---- PŘIHLÁŠENÍ ---- */

.login-page {
    background-image: none;
    background: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-wrap {
    display: flex;
    gap: 3rem;
    align-items: center;
    max-width: 820px;
    width: 100%;
}

.login-deco {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transform: rotate(-3deg);
}

.deco-card {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.4rem;
    box-shadow: 6px 6px 0 rgba(0,0,0,0.4);
    position: relative;
}

.deco-card--clue { transform: rotate(2deg); }
.deco-card--answer { transform: rotate(-1deg); background: var(--ink-light); color: var(--paper); }

.deco-label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 0.4rem;
}

.deco-card p { font-size: 0.8rem; line-height: 1.5; opacity: 0.8; }

.login-box {
    flex: 0 0 340px;
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: 8px 8px 0 var(--red), 16px 16px 0 rgba(192,57,43,0.3);
}

.login-title {
    font-size: 2rem;
    color: var(--ink);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.75rem;
    color: var(--ink-light);
    opacity: 0.6;
    margin-bottom: 2rem;
    font-family: var(--font-mono);
}

@media (max-width: 640px) {
    .login-wrap { flex-direction: column; }
    .login-deco { display: none; }
    .login-box { flex: none; width: 100%; }
}

/* ---- FORMULÁŘE ---- */

.field {
    margin-bottom: 1.2rem;
}

.field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 0.4rem;
    font-family: var(--font-display);
}

.field input,
.field textarea,
.field select {
    width: 100%;
    background: var(--white);
    border: 2px solid var(--paper-dark);
    border-radius: var(--radius);
    padding: 0.6rem 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--ink);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(192,57,43,0.15);
}

.field textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.login-form .field input {
    background: var(--paper-warm);
    border-color: var(--paper-dark);
}

/* ---- TLAČÍTKA ---- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn--primary {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.btn--primary:hover { background: var(--red-light); border-color: var(--red-light); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }

.btn--secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--ink);
}
.btn--secondary:hover { background: var(--ink); color: var(--paper); }

.btn--ghost {
    background: transparent;
    color: var(--ink-light);
    border-color: var(--paper-dark);
}
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }

.btn--danger {
    background: transparent;
    color: var(--red);
    border-color: var(--red);
}
.btn--danger:hover { background: var(--red); color: var(--white); }

.btn--small { font-size: 0.75rem; padding: 0.35rem 0.8rem; }
.btn--full { width: 100%; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---- ALERTY ---- */

.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 1.2rem;
    border-left: 4px solid;
}

.alert--error { background: #fdf0ef; border-color: var(--red); color: var(--red); }
.alert--success { background: #edf7f1; border-color: var(--green); color: var(--green); }
.alert--info { background: #eef2ff; border-color: #5563de; color: #3c4bb0; }
.alert--warning { background: #fffbeb; border-color: var(--gold); color: var(--gold); }

/* ---- TABULKY ---- */

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead th {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-light);
    background: var(--paper-warm);
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--paper-dark);
}

tbody tr { border-bottom: 1px solid var(--paper-dark); transition: background var(--transition); }
tbody tr:hover { background: var(--paper-warm); }
tbody td { padding: 0.7rem 1rem; vertical-align: middle; }

/* ---- KARTY / PANELY ---- */

.card {
    background: var(--white);
    border: 1px solid var(--paper-dark);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    background: var(--paper-warm);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--paper-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-body { padding: 1.5rem; }

.section {
    background: var(--white);
    border: 1px solid var(--paper-dark);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ---- ADMIN LAYOUT ---- */

.admin-layout {
    display: flex;
    min-height: calc(100vh - 56px);
}

.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--ink);
    color: var(--paper);
    padding: 1.5rem 0;
    position: sticky;
    top: 56px;
    height: calc(100vh - 56px);
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 1.5rem;
}

.sidebar-label {
    font-family: var(--font-display);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(245,240,232,0.35);
    padding: 0 1.2rem;
    margin-bottom: 0.4rem;
    display: block;
}

.sidebar-nav a {
    display: block;
    padding: 0.5rem 1.2rem;
    color: rgba(245,240,232,0.7);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(245,240,232,0.07);
    color: var(--paper);
    border-left-color: var(--red);
}

.admin-content {
    flex: 1;
    padding: 2rem;
    min-width: 0;
}

/* ---- HERNÍ KARTIČKY ---- */

.game-card {
    position: relative;
    background: var(--white);
    border: 2px solid var(--paper-dark);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 4px 4px 0 var(--paper-dark);
    transition: all var(--transition);
}

.game-card--clue {
    border-color: var(--ink-light);
    box-shadow: 4px 4px 0 var(--ink-light);
}

.game-card--answer {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
    box-shadow: 4px 4px 0 var(--red);
}

.game-card-type {
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.45;
    margin-bottom: 1rem;
    display: block;
}

.game-card-text {
    font-size: 1.05rem;
    line-height: 1.7;
}

.game-card--answer .game-card-text {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.2;
}

/* ---- HERNÍ PRŮBĚH ---- */

.game-status-bar {
    background: var(--ink);
    color: var(--paper);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.game-status-bar strong { font-family: var(--font-display); }

.progress-bar {
    background: var(--paper-dark);
    border-radius: 100px;
    height: 6px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: var(--red);
    border-radius: 100px;
    transition: width 1s linear;
}

/* Timer */
.timer {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--ink);
    text-align: center;
    line-height: 1;
}

.timer.timer--warning { color: var(--gold); }
.timer.timer--danger  { color: var(--red); animation: pulse 0.5s infinite alternate; }

@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }

/* ---- ŽEBŘÍČEK ---- */

.leaderboard { list-style: none; }

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--paper-dark);
    transition: background var(--transition);
}

.leaderboard-item:hover { background: var(--paper-warm); }

.leaderboard-rank {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--paper-dark);
    min-width: 2rem;
    text-align: center;
}

.leaderboard-rank.rank-1 { color: var(--gold); }
.leaderboard-rank.rank-2 { color: #888; }
.leaderboard-rank.rank-3 { color: #a0522d; }

.leaderboard-name { flex: 1; font-family: var(--font-display); font-weight: 600; }

.leaderboard-score {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--red);
}

/* ---- BADGE ---- */

.badge {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.55rem;
    border-radius: 100px;
    text-transform: uppercase;
}

.badge--active  { background: #d4edda; color: #155724; }
.badge--waiting { background: #fff3cd; color: #856404; }
.badge--finished { background: var(--paper-warm); color: var(--ink-light); }

/* ---- GRID ---- */

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: relative; top: 0; }
    .admin-content { padding: 1rem; }
}

/* ---- MAIN CONTENT ---- */

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* ---- STUDENT HERNÍ PLOCHA ---- */

.student-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.waiting-screen {
    text-align: center;
    padding: 4rem 2rem;
}

.waiting-screen h2 { font-size: 2rem; margin-bottom: 1rem; }
.waiting-screen p { color: var(--ink-light); margin-bottom: 2rem; }

.waiting-dots span {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--red);
    border-radius: 50%;
    margin: 0 4px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.waiting-dots span:nth-child(2) { animation-delay: 0.16s; }
.waiting-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ---- PROJEKTOR VIEW ---- */

.projector-card {
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
}

.projector-question {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 2rem;
}

.projector-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.45;
    margin-bottom: 1rem;
    font-family: var(--font-display);
    font-weight: 600;
}

/* ---- UTILITIES ---- */

.text-center { text-align: center; }
.text-muted { color: var(--ink-light); opacity: 0.6; }
.text-small { font-size: 0.8rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.flex-center { display: flex; align-items: center; gap: 0.5rem; }
.w-full { width: 100%; }

/* ---- ANIMACE PŘECHODU ---- */

.fade-in {
    animation: fadeIn 0.35s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- KARTIČKOVÝ EDITOR ---- */

.pair-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem;
    background: var(--paper-warm);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--paper-dark);
}

.pair-row textarea { min-height: 60px; }

/* ---- MODAL ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,26,46,0.7);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background: var(--paper);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 8px 8px 0 var(--red);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid var(--paper-dark);
    padding-bottom: 0.8rem;
}
