/* Fantasy Football Projections - 3D Glassmorphic Apple Theme */

:root {
    /* Apple Dark Mode Colors - Performance Optimized */
    --primary-color: #0A84FF;
    --primary-dark: #0070E0;
    --primary-light: #409CFF;
    --secondary-color: #30D158;
    --danger-color: #FF453A;
    --background: #000000;
    --surface: #1C1C1E;
    --surface-elevated: #2C2C2E;
    --glass-bg: linear-gradient(135deg, rgba(28, 28, 30, 0.95) 0%, rgba(44, 44, 46, 0.95) 100%);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #FFFFFF;
    --text-secondary: #98989D;
    --text-tertiary: #636366;
    --border-color: rgba(255, 255, 255, 0.08);
    --hover-overlay: rgba(255, 255, 255, 0.05);
    --shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px -4px rgba(0, 0, 0, 0.4);
    --shadow-3d: 0 12px 32px -8px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Hardware Acceleration */
header,
.controls,
.stats-bar,
.position-tabs {
    transform: translateZ(0);
}

/* Animated Gradient Background */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    background: #000000;
    color: var(--text-primary);
    line-height: 1.47059;
    font-size: 17px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(10, 132, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(48, 209, 88, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 10%, rgba(255, 69, 58, 0.04) 0%, transparent 50%);
    animation: gradientShift 40s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(-2%, -2%, 0); }
}

/* Floating Shapes - Ultra Optimized */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0.2;
    animation: float 30s ease-in-out infinite;
}

.shape-1 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(10, 132, 255, 0.2), transparent);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(48, 209, 88, 0.15), transparent);
    top: 50%;
    right: 10%;
    animation-delay: 10s;
}

.shape-3 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(191, 90, 242, 0.15), transparent);
    bottom: 10%;
    left: 30%;
    animation-delay: 20s;
}

@keyframes float {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(15px, -15px, 0);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    perspective: 2000px;
    position: relative;
    z-index: 1;
}

/* Optimized Header with 3D Effect */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 60px 30px;
    background: linear-gradient(135deg,
        rgba(28, 28, 30, 0.98) 0%,
        rgba(44, 44, 46, 0.98) 50%,
        rgba(28, 28, 30, 0.98) 100%);
    color: var(--text-primary);
    border-radius: 24px;
    box-shadow: var(--shadow-3d), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    position: relative;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 24px;
    background: radial-gradient(circle at 30% 20%, rgba(10, 132, 255, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(48, 209, 88, 0.08) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

header > * {
    position: relative;
    z-index: 1;
}

header:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-3d), 0 0 30px rgba(10, 132, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2.75rem;
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transform: translateZ(30px);
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
    transform: translateZ(20px);
}

/* Optimized Controls with 3D Lift */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    padding: 24px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.controls:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-3d), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.control-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

select, input[type="text"] {
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
    background: rgba(44, 44, 46, 0.8);
    color: var(--text-primary);
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

select:hover, input[type="text"]:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

select:focus, input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.2), 0 8px 16px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* Dropdown options styling */
select option {
    background: var(--surface-elevated);
    color: var(--text-primary);
    padding: 10px;
    font-size: 15px;
}

/* 3D Glassmorphic Buttons */
.btn-primary, .btn-secondary, .btn-small {
    padding: 12px 24px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.btn-primary::before, .btn-secondary::before, .btn-small::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before, .btn-secondary:hover::before, .btn-small:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-3px) translateZ(10px);
    box-shadow: 0 12px 30px rgba(10, 132, 255, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px) translateZ(5px);
}

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

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #20B848 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #40DE68 0%, var(--secondary-color) 100%);
    transform: translateY(-3px) translateZ(10px);
    box-shadow: 0 12px 30px rgba(48, 209, 88, 0.4);
}

.btn-secondary:active {
    transform: translateY(-1px) translateZ(5px);
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 600;
}

.btn-small:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 20px rgba(10, 132, 255, 0.35);
}

.btn-small:active {
    transform: translateY(0) scale(0.98);
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Optimized Stats Bar */
.stats-bar {
    display: flex;
    gap: 30px;
    padding: 20px 28px;
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    border-radius: 18px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.stats-bar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-3d), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.stat-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stat-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 700;
    color: var(--primary-color);
}

/* Optimized Messages */
.loading-message {
    text-align: center;
    padding: 60px 30px;
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    border-radius: 20px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    animation: floatIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.loading-subtext {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 8px;
    font-weight: 400;
}

.error-message {
    padding: 18px 24px;
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.2), rgba(255, 69, 58, 0.15));
    border: 1px solid rgba(255, 69, 58, 0.4);
    border-radius: 14px;
    color: var(--danger-color);
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(255, 69, 58, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: floatIn 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.welcome-message {
    text-align: center;
    padding: 60px 30px;
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    border-radius: 20px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    animation: floatIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.welcome-message h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-weight: 600;
}

.welcome-message p {
    color: var(--text-secondary);
    font-size: 15px;
}

.welcome-message ul {
    list-style: none;
    margin-top: 20px;
}

.welcome-message li {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 15px;
}

.welcome-message li:before {
    content: "✓ ";
    color: var(--secondary-color);
    font-weight: 600;
    margin-right: 8px;
}

.no-results {
    text-align: center;
    padding: 40px 30px;
    color: var(--text-secondary);
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Optimized Position Tabs */
.position-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    padding: 14px;
    border-radius: 18px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    flex-wrap: wrap;
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.position-tabs:hover {
    transform: translateY(-2px);
}

.position-tab {
    padding: 12px 24px;
    border: none;
    background: rgba(44, 44, 46, 0.9);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.23, 1, 0.32, 1);
    font-family: inherit;
    letter-spacing: -0.01em;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
}

.position-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.position-tab:hover::before {
    opacity: 1;
}

.position-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.position-tab:active {
    transform: translateY(0) scale(0.98);
}

.position-tab.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 8px 24px rgba(10, 132, 255, 0.4);
}

.position-badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    min-width: 38px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.position-badge:hover {
    transform: translateY(-2px) scale(1.05);
}

.position-badge.QB {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.position-badge.RB {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.4);
}

.position-badge.WR {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.position-badge.TE {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.4);
}

/* Optimized Table */
.projections-table {
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    border-radius: 20px;
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--glass-border);
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
    animation: floatIn 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.projections-table:hover {
    box-shadow: var(--shadow-3d), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

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

.data-table thead {
    background: rgba(44, 44, 46, 0.8);
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    padding: 16px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
    vertical-align: middle;
}

.data-table td {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 15px;
    transition: background 0.2s ease;
    white-space: nowrap;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(10, 132, 255, 0.08);
}

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

.rank {
    font-weight: 600;
    color: var(--text-secondary);
    width: 60px;
    font-variant-numeric: tabular-nums;
}

.player-name {
    font-weight: 500;
    color: var(--text-primary);
}

.points {
    font-weight: 500;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.total-points {
    color: var(--primary-color);
    font-size: 1.05rem;
    font-weight: 600;
}

/* Optimized 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: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

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

.modal {
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.98) 0%, rgba(44, 44, 46, 0.98) 100%);
    border-radius: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-3d), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    animation: modalSlideIn 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(44, 44, 46, 0.5);
    color: var(--text-primary);
    border-radius: 24px 24px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-weight: 600;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    transition: color 0.15s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.detail-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.detail-section h4 {
    margin: 20px 0 10px;
    color: var(--text-secondary);
}

.total-points-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: block;
}

.breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(44, 44, 46, 0.8);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.breakdown-item:hover {
    background: rgba(55, 55, 58, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.breakdown-item .label {
    font-weight: 600;
    color: var(--text-secondary);
}

.breakdown-item .value {
    font-weight: 700;
    color: var(--text-primary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.stats-grid .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(44, 44, 46, 0.8);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.stats-grid .stat-item:hover {
    background: rgba(55, 55, 58, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.stats-grid .stat-label {
    text-transform: capitalize;
    color: var(--text-secondary);
}

.stats-grid .stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
    font-size: 13px;
    font-weight: 400;
}

/* Optimizer Styles */
.optimizer-section {
    margin-bottom: 40px;
}

.section-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.leagues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.league-card {
    background: linear-gradient(135deg, rgba(28, 28, 30, 0.97) 0%, rgba(44, 44, 46, 0.97) 100%);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
}

.league-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-3d), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.league-card h3 {
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.league-details {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(10, 132, 255, 0.15);
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--primary-color);
}

.optimization-results {
    margin-top: 30px;
}

.recommendations-section {
    margin-bottom: 40px;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.recommendation-card {
    background: linear-gradient(135deg, rgba(10, 132, 255, 0.1), rgba(10, 132, 255, 0.05));
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.rec-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.rec-gain {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--secondary-color);
    padding: 6px 14px;
    background: rgba(48, 209, 88, 0.15);
    border-radius: 8px;
}

.rec-swap {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}

.rec-action {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.action-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rec-action.sit .action-label {
    color: var(--danger-color);
}

.swap-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.player-proj {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.rec-position {
    display: flex;
    justify-content: flex-end;
}

.lineup-section {
    margin-bottom: 40px;
}

.position-group {
    margin-bottom: 24px;
}

.position-header {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-card {
    background: rgba(44, 44, 46, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.player-card.starter {
    border-left: 3px solid var(--primary-color);
}

.player-card.bench {
    opacity: 0.7;
}

.player-card:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.player-projection {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.injury-badge {
    padding: 3px 8px;
    background: rgba(255, 69, 58, 0.2);
    border: 1px solid var(--danger-color);
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--danger-color);
    font-weight: 600;
    text-transform: uppercase;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 12px;
    }

    /* Header */
    header {
        padding: 30px 16px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    /* Controls */
    .controls {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }

    .control-group {
        width: 100%;
        min-width: unset;
    }

    select, input[type="text"] {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 12px 14px;
    }

    /* Stats Bar */
    .stats-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .stat-item {
        justify-content: space-between;
        width: 100%;
    }

    /* Position Tabs */
    .position-tabs {
        padding: 8px;
        gap: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }

    .position-tabs::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }

    .position-tab {
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Table Container */
    .projections-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        font-size: 13px;
        min-width: 700px; /* Ensures table doesn't collapse */
    }

    .data-table th,
    .data-table td {
        padding: 10px 6px;
    }

    .data-table th {
        font-size: 11px;
    }

    .player-name {
        min-width: 120px;
        font-size: 14px;
    }

    .rank {
        width: 40px;
        font-size: 13px;
    }

    .position-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
        min-width: 30px;
    }

    .btn-small {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Modal */
    .modal {
        max-width: 100%;
        margin: 10px;
        max-height: 95vh;
    }

    .modal-header {
        padding: 16px;
    }

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

    .modal-body {
        padding: 16px;
    }

    .detail-section {
        margin-bottom: 20px;
    }

    .total-points-large {
        font-size: 1.5rem;
    }

    .breakdown {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Messages */
    .loading-message,
    .welcome-message,
    .no-results {
        padding: 40px 16px;
    }

    .error-message {
        padding: 12px 16px;
        font-size: 14px;
    }

    /* Footer */
    footer {
        padding: 30px 16px;
        font-size: 12px;
    }
}

/* Extra small devices (phones in portrait, less than 400px) */
@media (max-width: 400px) {
    header h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 4px;
    }

    .btn-small {
        padding: 5px 8px;
        font-size: 11px;
    }

    .position-tab {
        padding: 8px 12px;
        font-size: 13px;
    }
}

/* Landscape orientation on mobile */
@media (max-width: 900px) and (orientation: landscape) {
    .container {
        padding: 12px;
    }

    header {
        padding: 20px 16px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .modal {
        max-height: 85vh;
    }
}
