/* ==========================================================================
   Cricbuzz Native Theme (Base & Variables)
   ========================================================================== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Roboto', sans-serif; 
}

:root {
    /* Exact Cricbuzz Brand Colors */
    --primary-color: #009270; 
    --primary-dark: #00755a;
    --background-color: #f3f4f6; /* Native app light gray background */
    --surface-color: #ffffff;    /* Pure white cards */
    
    /* Text */
    --text-primary: #1f2937;     /* Near black for high contrast */
    --text-secondary: #6b7280;   /* Gray for subtitles */
    --border-color: #e5e7eb;
    
    /* Actions */
    --danger: #ef4444;
    --warning: #f59e0b;
}

body {
    background-color: var(--background-color);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent; /* Removes blue tap highlight on mobile */
}

/* ==========================================================================
   Layout & Screens
   ========================================================================== */
.app-content { 
    flex: 1; 
    overflow-y: auto; 
    position: relative; 
    padding-bottom: 70px; /* Space for bottom nav */
}

.screen { 
    display: none; 
    animation: fadeIn 0.2s ease;
}

.screen.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hidden { display: none !important; }

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header { 
    background-color: var(--primary-color);
    color: white; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 16px; 
    height: 56px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10; 
}

.header-left, .header-right { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
}

.header-left h1 { 
    font-size: 18px; 
    font-weight: 500; 
}

/* Bottom Nav - Native iOS/Android Style */
.bottom-nav { 
    position: fixed; 
    bottom: 0; left: 0; right: 0; 
    display: flex; 
    justify-content: space-around; 
    align-items: center; 
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color); 
    height: 60px; 
    padding: 0 8px; 
    z-index: 50; 
}

.nav-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    color: var(--text-secondary); 
    cursor: pointer; 
    flex: 1; 
    height: 100%; 
}

.nav-item.active { 
    color: var(--primary-color); 
}

.nav-item span:last-child { 
    font-size: 12px; 
    margin-top: 4px; 
    font-weight: 500;
}

/* ==========================================================================
   Cards & Containers
   ========================================================================== */
.card, .list-item, .modal, .scoring-controls, .this-over-container { 
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px; 
    padding: 16px; 
    margin-bottom: 12px; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05); 
}

.list-container, .form-container { 
    padding: 12px; 
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-group { margin-bottom: 20px; }

.form-group input[type="text"], 
.form-group input[type="number"],
.form-group select { 
    width: 100%; 
    padding: 12px 0; 
    border: none; 
    border-bottom: 1px solid var(--border-color); 
    background-color: transparent; 
    font-size: 16px; 
    color: var(--text-primary);
    outline: none; 
    transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
    border-bottom: 2px solid var(--primary-color);
}

.section-title { 
    color: var(--primary-color); 
    font-size: 13px; 
    font-weight: 600; 
    margin-top: 24px; 
    margin-bottom: 12px; 
    text-transform: uppercase; 
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn { 
    padding: 12px 20px; 
    border: none; 
    border-radius: 4px; 
    font-size: 14px; 
    font-weight: 600; 
    cursor: pointer; 
    text-transform: uppercase; 
    transition: background 0.2s ease;
}

.btn-primary { 
    background-color: var(--primary-color); 
    color: white; 
    box-shadow: 0 2px 4px rgba(0, 146, 112, 0.2);
}

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

.btn-secondary { 
    background-color: transparent; 
    color: var(--primary-color); 
    border: 1px solid var(--primary-color); 
}

/* Floating Action Button */
.fab { 
    position: fixed; 
    bottom: 80px; 
    right: 20px; 
    width: 56px; 
    height: 56px; 
    border-radius: 50%; 
    background-color: var(--primary-color); 
    color: white; 
    border: none; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.2); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    cursor: pointer; 
    z-index: 20; 
}
.fab:active { background-color: var(--primary-dark); }

/* ==========================================================================
   Scoring Specific UI
   ========================================================================== */
.number-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 8px; 
    margin-top: auto; 
}

.num-btn { 
    aspect-ratio: 1; 
    border-radius: 50%; 
    background-color: var(--surface-color); 
    border: 1px solid var(--border-color); 
    font-size: 20px; 
    font-weight: 500;
    color: var(--text-primary); 
    cursor: pointer; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.num-btn:active { 
    background-color: #e5e7eb; 
}

.num-btn.boundary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: bold;
}

/* This Over Bubbles */
.ball-circle { 
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    border: 1px solid var(--border-color); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    font-size: 13px; 
    font-weight: 500;
    color: var(--text-primary); 
    flex-shrink: 0; 
    background-color: var(--surface-color);
}

.ball-circle.boundary { background-color: var(--primary-color); color: white; border-color: var(--primary-color); }
.ball-circle.wicket { background-color: var(--danger); color: white; border-color: var(--danger); }
.ball-circle.extra { background-color: var(--border-color); color: var(--text-primary); }

/* ==========================================================================
   Modals & Lists
   ========================================================================== */
.modal-overlay { 
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
    background-color: rgba(0,0,0,0.5); 
    display: flex; justify-content: center; align-items: center; 
    z-index: 100; 
}

.modal { width: 90%; max-width: 400px; padding: 24px; }
.modal-title { font-size: 18px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }

.list-item { 
    display: flex; align-items: center; padding: 16px; margin-bottom: 8px; border-radius: 8px;
}

.avatar { 
    width: 40px; height: 40px; border-radius: 50%; 
    background-color: var(--border-color); color: var(--text-secondary); 
    display: flex; justify-content: center; align-items: center; 
    font-weight: bold; font-size: 16px; margin-right: 16px; 
}

.item-content { flex: 1; }
.item-title { font-size: 16px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.item-subtitle { font-size: 12px; color: var(--text-secondary); }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(16px); }
.slider.round { border-radius: 24px; }
.slider.round:before { border-radius: 50%; }

/* ==========================================================================
   Utilities & Helpers
   ========================================================================== */
/* Horizontal scrollbar hider for Match Cards on Home Screen */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
.snap-x { scroll-snap-type: x mandatory; }
