/* ===== PageantScore App Design System ===== */
/* App pages use teal accent, warm cream bg, Plus Jakarta Sans */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

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

:root {
    --accent: #00b894;
    --accent-hover: #00a381;
    --accent-light: rgba(0, 184, 148, 0.08);
    --accent-glow: rgba(0, 184, 148, 0.15);
    --text: #2d3436;
    --text-secondary: #636e72;
    --text-light: #b2bec3;
    --bg: #f8f6f1;
    --bg-card: #ffffff;
    --border: #e9ecef;
    --danger: #e05c5c;
    --danger-light: rgba(224, 92, 92, 0.08);
    --warning: #f0a500;
    --warning-light: rgba(240, 165, 0, 0.08);
    --success: #00b894;
    --font: 'Plus Jakarta Sans', system-ui, sans-serif;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-pill: 100px;
}

html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== Typography ===== */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; color: var(--text); }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-center { text-align: center; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }

/* ===== Layout ===== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}
.container-narrow {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-header {
    padding: 32px 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.page-header h1 { margin: 0; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ===== Navigation ===== */
.app-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.app-nav-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
.app-nav-logo span { color: var(--accent); }
.app-nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.app-nav-user {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}
.card-hover:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: rgba(0, 184, 148, 0.2);
    cursor: pointer;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 184, 148, 0.25);
}

.btn-secondary {
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--accent-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: #c94444;
}

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-pill { border-radius: var(--radius-pill); }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.form-hint {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
}
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-input.error,
.form-select.error {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-light);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-error {
    font-size: 13px;
    color: var(--danger);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Toggle switch */
.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.toggle-track {
    width: 44px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
}
.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle.active .toggle-track {
    background: var(--accent);
}
.toggle.active .toggle-track::after {
    transform: translateX(20px);
}
.toggle-label { font-size: 14px; font-weight: 500; }

/* ===== Tables ===== */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px 16px;
    text-align: left;
    font-size: 14px;
}
th {
    background: #f8f7f4;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
td { border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0, 184, 148, 0.02); }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--accent-light); color: var(--accent); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-neutral { background: rgba(0,0,0,0.04); color: var(--text-secondary); }
.badge-test { background: #fff3cd; color: #856404; }

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font);
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ===== Wizard Steps ===== */
.wizard-steps {
    display: flex;
    gap: 4px;
    margin-bottom: 32px;
}
.wizard-step {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.wizard-step.active {
    background: var(--accent);
    color: #fff;
}
.wizard-step.completed {
    background: var(--accent-light);
    color: var(--accent);
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}
.modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}
.modal-body {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

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

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    max-width: 400px;
}
.toast-success { background: var(--accent); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--text); color: #fff; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== Progress Bar ===== */
.progress {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ===== Checklist ===== */
.checklist { list-style: none; }
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.checklist-icon.done { background: var(--accent-light); color: var(--accent); }
.checklist-icon.pending { background: rgba(0,0,0,0.04); color: var(--text-light); }

/* ===== Demo Banner ===== */
.demo-banner {
    background: linear-gradient(135deg, #B69455, #D4B87A);
    color: #fff;
    padding: 10px 24px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}
.demo-banner a { color: #fff; text-decoration: underline; }

/* ===== Color Picker ===== */
.color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.color-picker-wrap input[type="color"] {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 2px;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 15px; max-width: 400px; margin: 0 auto 24px; }

/* ===== Score Buttons (Judge UI) ===== */
.score-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.score-btn {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
    font-size: 18px;
    font-weight: 700;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.score-btn:hover { border-color: var(--accent); }
.score-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    transform: scale(1.05);
}

/* Score input for 1-100 */
.score-input-100 {
    display: flex;
    align-items: center;
    gap: 12px;
}
.score-input-100 .score-value {
    font-size: 32px;
    font-weight: 800;
    min-width: 60px;
    text-align: center;
}
.score-input-100 .score-adjust {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.score-input-100 .score-adjust:active {
    background: var(--accent-light);
}

/* Auto-save indicator */
.auto-saved {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
}
.auto-saved.show { opacity: 1; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .wizard-steps { flex-wrap: wrap; }
}

@media (max-width: 600px) {
    .container { padding: 0 16px; }
    h1 { font-size: 24px; }
    .card { padding: 20px 16px; }
    .score-btn { width: 46px; height: 46px; font-size: 16px; }
    .modal { padding: 24px 20px; margin: 16px; }
    .tabs { overflow-x: auto; }
}
