@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
    /* Color Palette */
    --primary: #10b981;
    /* Emerald 500 */
    --primary-hover: #059669;
    /* Emerald 600 */
    --primary-glow: rgba(16, 185, 129, 0.4);

    --bg-dark: #0f172a;
    /* Slate 900 */
    --bg-darker: #020617;
    /* Slate 950 */

    --surface-card: rgba(30, 41, 59, 0.6);
    /* Slate 800 alpha */
    --surface-card-hover: rgba(30, 41, 59, 0.8);

    --text-main: #f1f5f9;
    /* Slate 100 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    --border-glass: rgba(255, 255, 255, 0.08);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.45);

    /* Spacing & Layout */
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --header-height: 60px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at top right, #1e293b, #0f172a 60%, #020617);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    padding: env(safe-area-inset-top) 1rem 1rem 1rem;
    padding-bottom: 80px;
    /* Space for bottom actions/scrolling */
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #34d399, #10b981);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

/* Layout Containers */
.container {
    max-width: 600px;
    /* Mobile focused max-width */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Glass Cards */
.card {
    background: var(--surface-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-glass);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

/* Inputs & Form Elements */
input,
select,
textarea {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 16px;
    /* Prevents iOS zoom */
    width: 100%;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

/* Buttons */
button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

button:active {
    transform: scale(0.98);
}

button.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    box-shadow: none;
    border: 1px solid transparent;
}

button.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--border-glass);
}

button.icon-btn {
    padding: 0.5rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
}

/* Header Section */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

/* Top Control Bar (Sticky) */
.control-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    margin: -1rem -1rem 1rem -1rem;
    /* Negative margin to span full width */
    padding: 0.75rem 1rem;
    display: flex;
    flex-wrap: wrap;
    /* Changed from nowrap to wrap */
    gap: 0.5rem;
    /* overflow-x: auto;  Removed to use wrapping instead */
    /* -webkit-overflow-scrolling: touch; */
    align-items: center;
    justify-content: space-between;
    /* Improve spacing when wrapped */
}

/* .control-bar::-webkit-scrollbar {
    display: none;
} Removed scrollbar style as we are wrapping now */

/* Score Tracking Module */
.score-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 0.75rem;
    align-items: center;
}

.score-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    /* Changed to allow wrapping */
    /* overflow-x: auto; Removed scrolling */
    padding-bottom: 4px;
}

/* Round Summary Bar */
.summary-bar {
    display: flex;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.summary-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

/* Caddy Section */
.caddy-section {
    position: relative;
    overflow: hidden;
}

.caddy-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), transparent);
    opacity: 0.5;
}

.advice-card {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.advice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.club-highlight {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.confidence-badge {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Loading Spinner */
.loading-overlay {
    background: rgba(15, 23, 42, 0.8);
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--radius-lg);
    z-index: 10;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.flex-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.flex-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.full-width {
    width: 100%;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

/* List Styles (Files, Clubs) */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-glass);
    transition: background 0.2s;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.list-item:last-child {
    border-bottom: none;
}

/* Toggle/Details Summary Override */
details>summary {
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    padding: 0.5rem 0;
    color: var(--text-muted);
    transition: color 0.2s;
}

details>summary:hover,
details[open]>summary {
    color: var(--primary);
}

details>summary::-webkit-details-marker {
    display: none;
}

/* Table Container (for Course Details) */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
}

th {
    background: rgba(0, 0, 0, 0.3);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
}