/* ============================================
   DARDOS - Sistema de Control de Partidas
   Mobile-first, Dark Mode por defecto
   ============================================ */

/* Variables de Color */
:root {
    /* Dark Mode (default) */
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent-red: #e74c3c;
    --accent-green: #2ecc71;
    --accent-blue: #3498db;
    --accent-yellow: #f1c40f;
    --shadow: rgba(0, 0, 0, 0.5);
    --border: #444;
}

.light-mode {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --shadow: rgba(0, 0, 0, 0.1);
    --border: #ddd;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* PIN Screen */
.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pin-container {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo {
    margin-bottom: 40px;
}

.logo svg {
    color: var(--accent-red);
    margin-bottom: 10px;
}

.logo h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
}

.pin-form h2 {
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.pin-form p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.pin-inputs {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 30px;
}

.pin-digit {
    width: 60px;
    height: 70px;
    font-size: 2rem;
    text-align: center;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.pin-digit:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
    min-width: 48px;
}

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

.btn-primary:active {
    transform: scale(0.95);
    background: #c0392b;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-danger {
    background: #c0392b;
    color: white;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    transition: background 0.2s;
}

.icon-btn:active {
    background: var(--bg-tertiary);
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
}

#app-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    max-width: 1200px;
    margin: 0 auto;
}

#page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

#main-content {
    flex: 1;
    padding: 12px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 20px;
}

.view {
    animation: fadeIn 0.3s;
}

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

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.dashboard-card:active {
    transform: scale(0.98);
}

.dashboard-card.primary {
    border-color: var(--accent-red);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(231, 76, 60, 0.1));
}

.dashboard-card.secondary {
    border-color: var(--accent-yellow);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(241, 196, 15, 0.1));
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.dashboard-card h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-weight: 600;
}

.stat-card .champion-display,
.stat-card .last-game-display {
    color: var(--text-primary);
}

.dashboard-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.menu-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    color: var(--text-primary);
}

.menu-item span {
    font-size: 1.5rem;
}

.menu-item:active {
    transform: scale(0.95);
    background: var(--bg-tertiary);
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    transition: left 0.3s;
    z-index: 200;
    overflow-y: auto;
    padding: 20px;
}

.side-menu.open {
    left: 0;
}

.close-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
}

.side-menu a {
    display: block;
    padding: 16px;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.side-menu a:active {
    background: var(--bg-tertiary);
}

/* Dartboard Keyboard - LISTA VERTICAL */
.dartboard-keyboard {
    background: var(--bg-primary);
    padding: 16px 12px;
    margin-top: 16px;
}

.dartboard-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.dart-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.dart-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
    align-items: center;
}

.dart-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 4px;
}

.dart-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
}

.dart-option-btn {
    padding: 10px 6px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    min-height: 44px;
    transition: all 0.1s;
    text-align: center;
}

.dart-option-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}

.dart-option-btn.single {
    border-color: var(--border);
}

.dart-option-btn.double {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.dart-option-btn.triple {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.dart-special-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.action-btn {
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 50px;
    transition: all 0.1s;
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.miss {
    background: #555;
    color: white;
}

.action-btn.undo {
    background: var(--accent-yellow);
    color: #000;
}

/* Game Display */
.game-display {
    padding-bottom: 0;
}

.current-player {
    text-align: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 12px;
}

.current-player h2 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.current-player .player-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-red);
}

.score-display {
    text-align: center;
    margin-bottom: 12px;
}

.score-main {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1;
    color: var(--accent-green);
}

.dart-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 8px 0;
}

.dart-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
}

.dart-dot.active {
    background: var(--accent-red);
}

.scoreboard {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

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

.scoreboard th, .scoreboard td {
    padding: 8px 6px;
    text-align: left;
    font-size: 0.9rem;
}

.scoreboard th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
}

.scoreboard tr {
    border-bottom: 1px solid var(--border);
}

.scoreboard tr:last-child {
    border-bottom: none;
}

/* Checkout Calculator */
.checkout-display {
    background: var(--accent-blue);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.checkout-display h3 {
    font-size: 0.75rem;
    margin-bottom: 4px;
    opacity: 0.9;
}

.checkout-suggestion {
    font-size: 1rem;
    font-weight: 600;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-footer button {
    flex: 1;
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
}

.toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    margin-bottom: 12px;
    animation: slideUp 0.3s;
}

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

.toast.success { border-left: 4px solid var(--accent-green); }
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.info { border-left: 4px solid var(--accent-blue); }

/* Responsive */
@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-menu {
        grid-template-columns: repeat(4, 1fr);
    }

    .pin-digit {
        width: 70px;
        height: 80px;
    }
}

@media (min-width: 1024px) {
    .numbers-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }

.error-message {
    color: var(--accent-red);
    font-size: 0.875rem;
    margin-top: 12px;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.list-item:active {
    transform: scale(0.98);
    background: var(--bg-tertiary);
}

/* Input fields y selects */
.input-field, select, input[type="text"], input[type="number"] {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
}

.input-field:focus, select:focus, input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Labels */
label {
    color: var(--text-primary);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

/* Párrafos */
p {
    color: var(--text-primary);
}

/* Strong y bold */
strong, b {
    color: var(--text-primary);
}
