/* ============================================
   EscapeMania QR Game - Styles
   Mobile-first responsive design
   ============================================ */

/* ============== RESET & BASE ============== */

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

:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4CAF50;
    --text-color: #333;
    --text-light: #666;
    --text-muted: #999;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --border-color: #ddd;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-small: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    text-decoration: underline;
}

/* ============== BUTTONS ============== */

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-small);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-2px);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #1976D2;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* ============== FORMS ============== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-small);
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group .help-text {
    display: block;
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

/* ============== BADGES ============== */

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #e8f5e9;
    color: var(--success-color);
}

.badge-inactive {
    background: #f5f5f5;
    color: var(--text-muted);
}

.badge-warning {
    background: #fff3e0;
    color: var(--warning-color);
}

/* ============== ALERTS ============== */

.alert {
    padding: 16px 20px;
    border-radius: var(--radius-small);
    margin-bottom: 20px;
}

.alert-error {
    background: #ffebee;
    color: var(--danger-color);
    border: 1px solid #ffcdd2;
}

/* ============== GAME PAGES ============== */

.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
    text-align: center;
}

.game-title {
    font-size: 24px;
    font-weight: 700;
}

.game-content {
    flex: 1;
    padding: 20px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.game-footer {
    background: var(--text-color);
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-size: 14px;
}

/* ============== HOME PAGE ============== */

.home-page {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
}

.home-header {
    text-align: center;
    padding: 40px 20px;
}

.home-header h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.home-header .subtitle {
    color: var(--text-light);
    font-size: 18px;
}

.games-list {
    margin-top: 30px;
}

.games-list h2 {
    margin-bottom: 20px;
}

.game-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.game-card h3 {
    margin-bottom: 10px;
}

.game-card .game-info {
    color: var(--text-light);
    margin-bottom: 15px;
}

.home-footer {
    text-align: center;
    padding: 40px 20px;
}

.admin-link {
    color: var(--text-muted);
    font-size: 14px;
}

/* ============== WELCOME PAGE ============== */

.welcome-page {
    text-align: center;
}

.welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.welcome-page h2 {
    font-size: 28px;
    margin-bottom: 20px;
}

.welcome-text {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    font-size: 18px;
    line-height: 1.8;
}

.game-info-box {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 30px;
    text-align: left;
}

.game-info-box h3 {
    margin-bottom: 15px;
}

.rules-list {
    list-style: none;
    margin-bottom: 20px;
}

.rules-list li {
    padding: 8px 0;
    font-size: 16px;
}

.location-info {
    background: #e8f5e9;
    padding: 15px;
    border-radius: var(--radius-small);
    text-align: center;
}

.registration-form {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.registration-form h3 {
    margin-bottom: 20px;
}

.note {
    color: var(--warning-color);
    font-size: 14px;
}

/* ============== LOCATION FOUND PAGE ============== */

.location-found-page {
    text-align: center;
}

.already-found-badge,
.new-find-badge {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 500;
    margin-bottom: 20px;
}

.already-found-badge {
    background: #fff3e0;
    color: var(--warning-color);
}

.new-find-badge {
    background: #e8f5e9;
    color: var(--success-color);
}

.location-name {
    font-size: 28px;
    margin-bottom: 15px;
}

.location-description {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    font-size: 16px;
    line-height: 1.8;
}

.progress-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.progress-section h3 {
    margin-bottom: 15px;
}

.progress-bar-container {
    background: #e0e0e0;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 16px;
}

.stats-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.stat-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.next-hint-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.next-hint-section h3 {
    margin-bottom: 15px;
}

.hint-box {
    background: #fff8e1;
    padding: 20px;
    border-radius: var(--radius-small);
    border-left: 4px solid var(--warning-color);
    font-size: 16px;
    line-height: 1.6;
}

.continue-section {
    padding: 20px;
}

.motivation {
    font-size: 20px;
    font-weight: 500;
}

/* ============== COMPLETE PAGE ============== */

.complete-page {
    text-align: center;
}

.celebration {
    margin-bottom: 30px;
}

.trophy {
    font-size: 80px;
    display: block;
    margin-bottom: 20px;
}

.celebration h2 {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.team-name {
    font-size: 18px;
    color: var(--text-light);
}

.result-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.result-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius);
}

.result-card.main-result {
    grid-column: span 2;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.result-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
}

.result-label {
    font-size: 12px;
    display: block;
    opacity: 0.8;
}

.result-value {
    font-size: 28px;
    font-weight: 700;
    display: block;
}

.result-value.time {
    font-size: 36px;
}

.leaderboard-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.leaderboard-section h3 {
    margin-bottom: 20px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th {
    font-weight: 600;
    color: var(--text-light);
}

.leaderboard-table tr.highlight {
    background: #e8f5e9;
}

.leaderboard-table .position {
    width: 50px;
}

.leaderboard-table .time {
    font-family: monospace;
    font-size: 16px;
}

/* ============== LEADERBOARD PAGE ============== */

.leaderboard-page {
    text-align: center;
}

.leaderboard-page h2 {
    font-size: 28px;
    margin-bottom: 25px;
}

.stats-summary {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
}

.stat-item .stat-icon {
    font-size: 32px;
}

.stat-item .stat-value {
    font-size: 28px;
}

.stat-item .stat-label {
    font-size: 14px;
}

.back-link {
    display: inline-block;
    margin-top: 30px;
}

/* ============== ERROR PAGE ============== */

.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.error-page h1 {
    font-size: 28px;
    margin-bottom: 15px;
}

.error-message {
    color: var(--text-light);
    margin-bottom: 30px;
}

/* ============== EMPTY STATE ============== */

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

/* ============== ADMIN STYLES ============== */

.admin-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: #333;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.admin-logo a {
    color: white;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.admin-nav {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
}

.nav-link:hover {
    color: white;
}

.nav-link.logout {
    color: #ff6b6b;
}

.admin-content {
    flex: 1;
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.admin-footer {
    background: #f5f5f5;
    padding: 15px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

/* ============== LOGIN PAGE ============== */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 {
    margin-bottom: 10px;
}

.login-box .subtitle {
    color: var(--text-light);
    margin-bottom: 30px;
}

.login-form {
    text-align: left;
}

.login-form .btn {
    width: 100%;
    margin-top: 10px;
}

.login-box .back-link {
    display: block;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ============== DASHBOARD ============== */

.dashboard-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.admin-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.admin-card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 20px;
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.card-stats .stat {
    padding: 10px;
    background: var(--bg-color);
    border-radius: var(--radius-small);
}

.card-stats .stat-value {
    font-size: 24px;
    font-weight: 700;
    display: block;
}

.card-stats .stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============== GAME DETAIL ============== */

.game-detail-page .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-left .back-link {
    color: var(--text-muted);
}

.header-left h1 {
    font-size: 28px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stats-grid .stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 22px;
}

.locations-section,
.leaderboard-section,
.teams-section {
    margin-bottom: 40px;
}

.locations-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.location-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    display: grid;
    grid-template-columns: 50px 120px 1fr auto;
    gap: 20px;
    align-items: center;
    box-shadow: var(--shadow);
}

.location-order {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
}

.location-qr img {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-small);
}

.location-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.location-info .description,
.location-info .hint {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
}

.location-info .uuid {
    font-size: 12px;
    color: var(--text-muted);
}

.location-info code {
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
}

.location-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-table {
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
.admin-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-light);
}

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

/* ============== FORM PAGE ============== */

.form-page {
    max-width: 600px;
}

.form-page .page-header {
    margin-bottom: 30px;
}

.form-page .back-link {
    display: block;
    margin-bottom: 15px;
    color: var(--text-muted);
}

.form-page .subtitle {
    color: var(--text-light);
    margin-top: 5px;
}

.admin-form {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.danger-zone {
    margin-top: 40px;
    padding: 25px;
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    border-radius: var(--radius);
}

.danger-zone h3 {
    color: var(--danger-color);
    margin-bottom: 15px;
}

.qr-preview {
    margin-top: 30px;
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.qr-preview h3 {
    margin-bottom: 15px;
}

/* ============== RESPONSIVE ============== */

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-nav {
        width: 100%;
        justify-content: flex-start;
    }
    
    .admin-content {
        padding: 20px;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .location-card {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .location-order {
        order: 1;
    }
    
    .location-qr {
        order: 2;
    }
    
    .location-info {
        order: 3;
    }
    
    .location-actions {
        order: 4;
        flex-direction: row;
        justify-content: center;
    }
    
    .header-left,
    .header-actions {
        width: 100%;
    }
    
    .result-section {
        grid-template-columns: 1fr;
    }
    
    .result-card.main-result {
        grid-column: span 1;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}
