/* ═══════════════════════════════════════════════════
   PDGA Ratings — Shared Design System
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Color system */
    --surface-0: #f0f2f5;
    --surface-1: #ffffff;
    --surface-2: #f8f9fb;
    --surface-3: #eef0f4;

    --navy-900: #0f172a;
    --navy-800: #1e293b;
    --navy-700: #334155;
    --navy-600: #475569;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-subtle: rgba(59, 130, 246, 0.08);
    --accent-border: rgba(59, 130, 246, 0.2);

    --green: #10b981;
    --green-subtle: rgba(16, 185, 129, 0.1);
    --red: #ef4444;
    --red-subtle: rgba(239, 68, 68, 0.1);
    --amber: #f59e0b;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-overlay: 0 20px 60px rgba(15, 23, 42, 0.15), 0 4px 12px rgba(15, 23, 42, 0.08);

    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ─────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    background-color: var(--surface-0);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* ── App Shell ────────────────────────────────── */

.app-header {
    background: var(--navy-900);
    color: var(--text-inverse);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.app-logo {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-inverse);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-logo .logo-icon {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.app-nav {
    display: flex;
    gap: 2px;
}

.app-nav a {
    padding: 6px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}

.app-nav a:hover {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.08);
}

.app-nav a.active {
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.12);
}

/* ── Container ────────────────────────────────── */

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 24px 60px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin: 0 0 24px 0;
}

/* ── Loading ──────────────────────────────────── */

.loading {
    text-align: center;
    padding: 40px 20px;
    font-size: 15px;
    color: var(--text-secondary);
}

/* ── Tables ───────────────────────────────────── */

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

thead {
    position: sticky;
    top: 56px;
    z-index: 10;
}

th {
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

.expandable-row {
    cursor: pointer;
    transition: background var(--transition);
}

.expandable-row:hover {
    background: var(--accent-subtle);
}

.expanded-content {
    display: none;
}

.expanded-content td {
    padding: 0;
    background: var(--surface-2);
    border-top: 2px solid var(--accent);
}

.expanded-cell {
    padding: 20px !important;
}

/* ── Links ────────────────────────────────────── */

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

a:hover {
    color: var(--accent-hover);
}

/* ── Buttons ──────────────────────────────────── */

.btn {
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.4;
}

.btn:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Card Section ─────────────────────────────── */

.card-section {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
}

.card-section h3 {
    margin: 0 0 14px 0;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
}

.card-section-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Inputs ───────────────────────────────────── */

.input {
    padding: 9px 14px;
    font-size: 14px;
    font-family: var(--font-sans);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    background: var(--surface-1);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.input::placeholder {
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .card-section {
        padding: 16px;
    }

    .card-section-form {
        flex-direction: column;
    }

    .card-section-form .input {
        width: 100%;
    }
}

/* ── Refresh Icons ────────────────────────────── */

.refresh-icon {
    cursor: pointer;
    opacity: 0.4;
    margin-left: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all var(--transition);
    padding: 4px;
    border-radius: var(--radius-sm);
}

.refresh-icon:hover {
    opacity: 1;
    color: var(--accent);
    background: var(--accent-subtle);
}

.refresh-icon.spinning {
    animation: spin 0.8s linear infinite;
    color: var(--accent);
    opacity: 1;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ───────────────────────────────── */

@media (max-width: 768px) {
    .container {
        padding: 16px 12px 40px;
    }

    .page-title {
        font-size: 22px;
    }

    .header-inner {
        height: 48px;
    }

    .app-logo {
        font-size: 15px;
    }

    .app-nav a {
        padding: 5px 10px;
        font-size: 13px;
    }

    table {
        font-size: 13px;
    }

    th, td {
        padding: 10px 8px;
    }

    th {
        font-size: 10px;
    }

    .mobile-hide {
        display: none;
    }

    thead {
        top: 48px;
    }
}

@media (max-width: 480px) {
    th, td {
        padding: 8px 6px;
    }
}
