/* Master Mind 13 - Styles */
:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --surface2: #243044;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --success: #3fb950;
    --warning: #d29922;
    --danger: #f85149;
    --radius: 8px;
    --font: 'Segoe UI', system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Welcome page */
.welcome-page .site-header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--surface2);
}
.welcome-page .site-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}
.welcome-page .tagline {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}
.welcome-page .header-nav {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.welcome-page .header-nav .btn { font-size: 0.9rem; }

.welcome-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.intro {
    margin-bottom: 2rem;
}
.intro p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

.agenda {
    margin-bottom: 2rem;
}
.agenda h2 {
    font-size: 1.25rem;
    margin: 0 0 0.5rem;
}
.agenda-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 1.5rem;
}
.agenda-block {
    background: var(--surface);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.agenda-block h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
}
.agenda-block .duration {
    color: var(--text-muted);
    font-weight: 400;
}
.agenda-block ul, .agenda-block ol {
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}
.agenda-block li {
    margin: 0.25rem 0;
}
.agenda-block p {
    margin: 0.5rem 0 0;
}

/* FAQ / Dudas comunes */
.faq-section { margin-bottom: 2rem; }
.faq-intro {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.faq-block {
    background: var(--surface);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.faq-block h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
}
.faq-block p { margin: 0; }
.faq-block .duration { color: var(--text-muted); font-weight: 400; }
.faq-category {
    font-size: 1.1rem;
    margin: 2rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--surface2);
}
.faq-category-intro {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 1rem;
}
.faq-timeline { margin-top: 0.75rem; }
.faq-timeline h4 {
    font-size: 0.95rem;
    margin: 1rem 0 0.5rem;
}
.faq-timeline h4:first-child { margin-top: 0; }
.faq-timeline ul {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
}
.faq-timeline li { margin: 0.25rem 0; }
.faq-timeline p { margin: 0.5rem 0 0; }

/* Ejemplo de update */
.faq-update-example .update-table-wrap { overflow-x: auto; margin: 1rem 0; }
.update-example-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.update-example-table th,
.update-example-table td {
    border: 1px solid var(--surface2);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}
.update-example-table thead th {
    background: var(--surface2);
    color: var(--accent);
    font-weight: 600;
}
.update-example-table tbody th {
    background: var(--surface2);
    color: var(--text);
}
.update-example-table .update-item-block {
    margin: 0 0 0.5rem 0;
    padding-left: 0.5rem;
    border-left: 2px solid var(--accent);
}
.update-example-table .update-item-block:last-child {
    margin-bottom: 0;
}
.update-example-table .update-item {
    display: block;
    margin-bottom: 0.25rem;
}
.update-example-table .update-item:last-child {
    margin-bottom: 0;
}
.faq-update-example .update-extra { margin: 1rem 0 0.5rem; }
.faq-update-example .update-note {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.5rem 0 1rem;
    font-style: italic;
}
.faq-update-example h4 {
    font-size: 0.95rem;
    margin: 1.25rem 0 0.5rem;
}
.faq-update-example h4:first-of-type { margin-top: 0; }

.cta {
    text-align: center;
    padding: 1rem 0;
}

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--surface2);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}
.btn-secondary {
    background: var(--surface2);
    color: var(--text);
}
.btn-secondary:hover {
    background: var(--surface);
}

/* Reunion Cafe page */
.reunion-page .site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--surface2);
}
.reunion-page .site-header h1 {
    margin: 0;
    font-size: 1.25rem;
}
.reunion-page .site-header .nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.reunion-page .site-header .user-name {
    color: var(--text-muted);
    font-size: 0.9rem;
}
.reunion-page .site-header .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

.reunion-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.summary-section {
    background: var(--surface);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.summary-section h2 {
    font-size: 1.1rem;
    margin: 0 0 0.75rem;
}
.summary-section .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}
.summary-section .match-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.summary-section .match-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--surface2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.summary-section .match-list li:last-child {
    border-bottom: none;
}
.summary-section .match-badge {
    background: var(--success);
    color: #fff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Auth modal / panel */
.auth-panel {
    background: var(--surface);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 360px;
    margin: 0 auto 1.5rem;
}
.auth-panel h2 {
    font-size: 1.1rem;
    margin: 0 0 1rem;
}
.auth-panel .tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.auth-panel .tab {
    padding: 0.4rem 0.8rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
}
.auth-panel .tab.active {
    background: var(--surface2);
    color: var(--text);
}
.auth-panel .form-group {
    margin-bottom: 1rem;
}
.auth-panel label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
}
.auth-panel input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
}
.auth-panel input:focus {
    outline: none;
    border-color: var(--accent);
}
.auth-panel .error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}
.auth-panel .btn {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
}

/* Calendar */
.calendar-section h2 {
    font-size: 1.1rem;
    margin: 0 0 1rem;
}
.calendar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.calendar-actions .hint {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.calendar-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.calendar-grid {
    display: grid;
    grid-template-columns: 60px repeat(var(--calendar-days, 31), minmax(28px, 1fr));
    gap: 1px;
    background: var(--surface2);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    min-width: min(100%, 1100px);
}
.calendar-grid .cell {
    background: var(--surface);
    padding: 4px;
    min-height: 24px;
    font-size: 0.7rem;
    text-align: center;
}
.calendar-grid .cell.header {
    background: var(--surface2);
    font-weight: 600;
    position: sticky;
    left: 0;
    z-index: 2;
    pointer-events: none; /* let clicks pass through to slots when they scroll underneath */
}
.calendar-grid .cell.time-header {
    background: var(--surface2);
    color: var(--text-muted);
    white-space: nowrap;
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 2px 0 4px rgba(0,0,0,0.06);
    pointer-events: none; /* let clicks pass through to slots when they scroll underneath */
}
.calendar-grid .cell.header.day-header {
    display: flex;
    flex-direction: column;
    font-size: 0.7rem;
}
.calendar-grid .cell.header .day-num { font-weight: 700; }
.calendar-grid .cell.header .day-dow { color: var(--text-muted); font-size: 0.65rem; }
.calendar-grid .cell.header.weekend {
    background: rgba(88, 166, 255, 0.15);
}
.calendar-grid .cell.header.past {
    opacity: 0.5;
    color: var(--text-muted);
}
.calendar-grid .cell.slot.weekend {
    background: rgba(88, 166, 255, 0.08);
}
.calendar-grid .cell.slot.past {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
.calendar-grid .cell.slot.selected.weekend {
    background: var(--accent);
}
/* Visual week separator: first day of week 2, 3, 4, 5 (header row: empty is 1st, then days 1-31) */
.calendar-grid .cell.header.day-header:nth-child(9),
.calendar-grid .cell.header.day-header:nth-child(16),
.calendar-grid .cell.header.day-header:nth-child(23),
.calendar-grid .cell.header.day-header:nth-child(30) {
    border-left: 2px solid var(--surface2);
}
.calendar-grid .cell.slot {
    cursor: pointer;
    transition: background 0.1s;
    touch-action: none; /* allow tap/drag on mobile without triggering scroll */
    pointer-events: auto; /* ensure slots always receive clicks (headers use none so they don't block) */
}
.calendar-grid .cell.slot:hover {
    background: var(--surface2);
}
.calendar-grid .cell.slot.selected {
    background: var(--accent);
    color: #fff;
}
.calendar-grid .cell.slot.selected.dragging {
    opacity: 0.9;
}
.calendar-grid .cell.slot .count {
    font-size: 0.65rem;
    color: var(--text-muted);
    pointer-events: none;
    user-select: none;
}
.calendar-grid .cell.slot.selected .count {
    color: rgba(255,255,255,0.9);
}
.calendar-grid .cell.slot.majority-match:not(.past) {
    outline: 1px solid var(--accent);
}

.quick-select {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.quick-select button {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    cursor: pointer;
}
.quick-select button:hover {
    background: var(--surface);
}

.save-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: var(--radius);
}
.save-bar .save-msg {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.save-bar .save-msg.saved {
    color: var(--success);
}
.save-bar .save-msg.error {
    color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: 50px repeat(31, minmax(22px, 1fr));
    }
    .calendar-grid .cell {
        min-height: 20px;
        font-size: 0.6rem;
    }
}
