/* Golf Scorer - Mobile-First Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary: #1e3c72;
    --primary-dark: #152b52;
    --secondary: #2a5298;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --light: #f8f9fa;
    --dark: #343a40;
    --border: #dee2e6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow-x: hidden;
    padding-bottom: 60px;
    -webkit-font-smoothing: antialiased;
}

/* Views */
.view {
    display: none;
    min-height: 100vh;
}

.view.active {
    display: block;
}

/* Connection Banner */
.connection-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.connection-banner.hidden {
    transform: translateY(-100%);
}

.connection-banner.offline {
    background: #ffc107;
    color: #000;
}

.connection-banner.syncing {
    background: #17a2b8;
    color: white;
}

.connection-banner.online {
    background: #28a745;
    color: white;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-content {
    flex: 1;
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: white;
    transition: background 0.2s;
}

.btn-icon:active {
    background: rgba(255,255,255,0.3);
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login View */
.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

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

.login-container h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 10px;
}

.pin-input-group {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 30px 0;
}

.pin-input {
    width: 60px;
    height: 70px;
    font-size: 32px;
    text-align: center;
    border: 3px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    transition: border-color 0.2s;
}

.pin-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin: 10px 0;
}

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

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
}

.error-message.hidden {
    display: none;
}

.offline-notice {
    margin-top: 40px;
    padding: 20px;
    background: #d1ecf1;
    border-radius: 12px;
    font-size: 14px;
    color: #0c5460;
}

.offline-notice p {
    margin: 5px 0;
}

/* Content */
.content {
    padding: 20px;
}

/* Matches List */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.match-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.match-card:active {
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.match-number {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
}

.match-date {
    color: #666;
    font-size: 14px;
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
}

.team {
    flex: 1;
    padding: 12px;
    background: var(--light);
    border-radius: 8px;
}

.team-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 5px;
}

.team-players {
    font-size: 13px;
    color: #666;
}

.vs {
    font-weight: 700;
    color: #999;
    font-size: 12px;
}

.match-course {
    margin: 15px 0;
    font-size: 14px;
    color: #666;
}

.match-status {
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    margin-top: 15px;
}

.status-scheduled {
    background: #e7f1ff;
    color: var(--primary);
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.loading, .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* Score Summary */
.score-summary {
    background: white;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.player-summary {
    text-align: center;
    padding: 12px;
    background: var(--light);
    border-radius: 8px;
}

.player-summary .player-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary);
}

.player-summary .player-score {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.sync-status {
    margin-top: 5px;
    font-size: 18px;
}

/* Hole Navigator */
.hole-navigator {
    background: white;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.hole-display {
    text-align: center;
}

.hole-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hole-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin: 5px 0;
}

.hole-info {
    font-size: 14px;
    color: #666;
}

/* Score Entry */
.score-entry {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.score-input-group {
    background: white;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.player-info {
    flex: 1;
}

.player-info .player-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
}

.player-info .player-hcp {
    font-size: 13px;
    color: #666;
}

.score-input {
    width: 80px;
    height: 60px;
    font-size: 32px;
    text-align: center;
    border: 3px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
}

.score-input:focus {
    outline: none;
    border-color: var(--primary);
}

.score-input.pending {
    border-color: var(--warning);
}

.score-input.synced {
    border-color: var(--success);
}

.score-input[readonly] {
    background: var(--light);
}

.sync-indicator {
    font-size: 24px;
}

/* Quick Entry */
.quick-entry {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.quick-label {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 15px;
    text-align: center;
}

.quick-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.quick-btn {
    width: 56px;
    height: 56px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(0.95);
}

/* Hole Summary */
.hole-summary {
    margin-top: 20px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

.summary-table th {
    padding: 10px;
    text-align: left;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    border-bottom: 2px solid var(--border);
}

.summary-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
}

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

/* Responsive */
@media (max-width: 380px) {
    .pin-input {
        width: 50px;
        height: 60px;
        font-size: 28px;
    }
    
    .hole-number {
        font-size: 40px;
    }
    
    .score-input {
        width: 70px;
        height: 55px;
        font-size: 28px;
    }
}

/* iOS Safe Area */
@supports (padding: max(0px)) {
    body {
        padding-bottom: max(60px, env(safe-area-inset-bottom));
    }
    
    .header {
        padding-top: max(20px, env(safe-area-inset-top));
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #f0f0f0;
    }
    
    .match-card, .score-summary, .hole-navigator, 
    .score-input-group, .quick-entry, .hole-summary {
        background: #2a2a2a;
    }
    
    .team, .player-summary {
        background: #333;
    }
    
    .score-input {
        background: #2a2a2a;
        color: #f0f0f0;
        border-color: #444;
    }
    
    .quick-btn {
        background: #2a2a2a;
        color: #f0f0f0;
        border-color: #444;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.match-card {
    animation: slideIn 0.3s ease;
}
