/* --- Core Variables --- */
:root {
    --bg-white: #ffffff;
    --text-black: #111111;
    --red: #ff3b30;
    --red-hover: #e03126;
    --gray-light: #f2f2f7;
    --gray: #8e8e93;
    --border: #e5e5ea;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.04);
}

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

body {
    background-color: var(--bg-white);
    color: var(--text-black);
    font-family: 'Outfit', -apple-system, sans-serif;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 580px;
    /* Consistent with mockup frame feel */
    margin: 0 auto;
    padding: 20px;
    min-height: 85vh;
}

/* --- Header & Breadcrumbs --- */
.main-header {
    padding: 24px 20px;
    background: white;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.logo-text {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.logo-text .black {
    color: var(--text-black);
}

.logo-text .red {
    color: var(--red);
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--gray);
    text-transform: uppercase;
}

.breadcrumbs span {
    cursor: pointer;
    transition: color 0.2s;
}

.breadcrumbs span:hover {
    color: var(--text-black);
}

.breadcrumbs .active {
    color: var(--text-black);
    pointer-events: none;
}

.breadcrumbs span::after {
    content: ' ›';
    margin-left: 8px;
    opacity: 0.3;
}

.breadcrumbs span:last-child::after {
    content: '';
}

.app-footer {
    padding: 24px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sync-code-badge {
    background: #fff5f5;
    border: 1.5px solid var(--red);
    color: var(--red);
    padding: 6px 12px;
    border-radius: 12px;
    font-family: monospace;
    font-size: 0.8rem;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.sync-status-text {
    font-size: 0.65rem;
    color: var(--gray);
    font-weight: 800;
    margin-top: 12px;
    text-transform: uppercase;
}

/* --- Components --- */
.card {
    padding: 24px;
    border-radius: 24px;
    border: 1.5px solid var(--text-black);
    background: white;
}

.card.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-color: var(--glass-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.card.small-card {
    padding: 16px;
    border-radius: 16px;
}

.no-padding {
    padding: 0 !important;
    overflow: hidden;
}

.league-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.league-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    border: 2px solid var(--text-black);
    border-radius: 24px;
    cursor: pointer;
    min-height: 120px;
    background: white;
    transition: transform 0.2s, background 0.2s;
}

.league-card:hover {
    transform: translateY(-2px);
    background: var(--gray-light);
}

.league-card h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.league-card p {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray);
}

/* --- Stats Table --- */
.stats-table {
    width: 100%;
    margin-top: 10px;
}

.table-row {
    display: grid;
    grid-template-columns: 1fr 60px 110px;
    padding: 20px;
    border: 2px solid var(--text-black);
    border-radius: 16px;
    margin-bottom: 12px;
    align-items: center;
    font-size: 0.95rem;
    background: white;
}

.table-header {
    border: none;
    font-weight: 800;
    font-size: 0.75rem;
    color: var(--gray);
    text-transform: uppercase;
    padding: 10px 20px;
}

/* --- Draft --- */
.draft-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.player-scroll {
    max-height: 440px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.player-item:last-child {
    border-bottom: none;
}

.player-item strong {
    font-size: 1rem;
    font-weight: 700;
}

.player-item small {
    color: var(--gray);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-red {
    background: var(--red);
    color: white;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 800;
}

/* --- Dropdown Filters --- */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
}

.filter-dropdown-container {
    position: relative;
}

.dropdown-trigger {
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: white;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 160px;
    justify-content: space-between;
    transition: all 0.2s;
}

.dropdown-trigger:hover {
    border-color: var(--text-black);
}

.dropdown-trigger::after {
    content: '▼';
    font-size: 0.6rem;
    opacity: 0.3;
}

.dropdown-trigger.active {
    border-color: var(--red);
    background: #fffafa;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    width: 260px;
    padding: 14px;
    margin-top: 6px;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-search {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 12px;
    outline: none;
}

.dropdown-search:focus {
    border-color: var(--text-black);
}

.dropdown-links {
    font-size: 0.7rem;
    margin-bottom: 12px;
    display: flex;
    gap: 16px;
    padding: 0 4px;
}

.dropdown-links a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.dropdown-links a:hover {
    text-decoration: underline;
}

.dropdown-list {
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 12px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

/* Custom Scrollbar */
.dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-list::-webkit-scrollbar-thumb {
    background: #eee;
    border-radius: 10px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 12px;
    border-radius: 6px;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

.dropdown-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: white;
    flex-shrink: 0;
}

.dropdown-item.selected .dropdown-checkbox {
    background: #1a73e8;
    border-color: #1a73e8;
}

.dropdown-item.selected .dropdown-checkbox::after {
    content: '✓';
    font-weight: 900;
}

.dropdown-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.dropdown-footer button {
    padding: 8px 18px;
    font-size: 0.75rem;
    font-weight: 800;
    border-radius: 6px;
    cursor: pointer;
}

.btn-cancel {
    background: white;
    border: 1px solid var(--border);
    color: var(--gray);
}

.btn-ok {
    background: #0d652d;
    /* Google Sheets Green */
    border: 1px solid #0d652d;
    color: white;
}

/* --- Buttons & Forms --- */
.btn {
    padding: 14px 28px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-transform: uppercase;
}

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

.btn.primary:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.btn.outline-pill {
    background: white;
    border: 2px solid var(--text-black);
    border-radius: 50px;
    padding: 10px 24px;
}

.btn.outline-pill:hover {
    background: var(--gray-light);
}

.btn-mini {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    border: 1.5px solid var(--text-black);
    background: white;
    transition: all 0.2s;
}

.btn-mini.red {
    border-color: var(--red);
    color: var(--red);
    background: #fff5f5;
}

.btn-mini:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn.text-link {
    background: transparent;
    color: var(--gray);
    text-decoration: underline;
    font-size: 0.8rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--gray);
}

input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--text-black);
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
}

input:focus {
    border-color: var(--red);
}

/* --- Debug --- */
.debug-content {
    margin-top: 10px;
    font-size: 0.65rem;
    color: var(--gray);
    line-height: 1.6;
}

/* --- Utilities --- */
.hidden {
    display: none !important;
}

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

.text-left {
    text-align: left;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-8 {
    margin-top: 2rem;
}

.mt-12 {
    margin-top: 3rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.d-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.flex-column {
    flex-direction: column;
}

.flex-1 {
    flex: 1;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.items-center {
    align-items: center;
}

.mr-4 {
    margin-right: 1rem;
}

.draft-header-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.search-container {
    position: relative;
    flex: 1;
}

.live-status-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f4f4f7;
    padding: 6px 14px;
    border-radius: 100px;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

.max-w-sm {
    max-width: 360px;
}

.w-full {
    width: 100%;
}

/* --- Simple Table Draft Board --- */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.simple-table {
    width: 100%;
    min-width: 700px;
    /* Force scroll on narrow screens */
    border-collapse: collapse;
}

.simple-table th {
    text-align: left;
    padding: 14px 24px;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--gray);
    background: #f9f9fb;
    border-bottom: 2px solid var(--text-black);
    letter-spacing: 0.5px;
}

.simple-table td {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.simple-table tr.picked {
    background: #fbfbfb;
    opacity: 0.5;
}

.p-name {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-black);
}

.p-meta {
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 700;
}

.stat-cell {
    font-weight: 800;
    font-size: 0.9rem;
    color: #444;
}

.stat-cell.active {
    color: #4CAF50;
    background: #f0faf0;
}

.simple-table th.active-col {
    color: #4CAF50;
    background: #f0faf0;
}

.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.7rem !important;
    border-radius: 8px !important;
}

/* --- Navigation & Header Polish --- */
.draft-tabs-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.tab-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--gray);
}

.tab-btn.active {
    border-color: var(--text-black);
    color: var(--text-black);
    background: #f4f4f7;
}

.stat-tabs-container {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.stat-tab-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 800;
    background: white;
    white-space: nowrap;
    cursor: pointer;
}

.stat-tab-btn.active {
    background: var(--text-black);
    color: white;
    border-color: var(--text-black);
}

/* --- Status Badge Fix --- */
.live-status-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge-red {
    background: var(--red);
    color: white;
    padding: 6px 16px;
    border-radius: 100px;
    font-weight: 800;
    font-size: 0.75rem;
}

.badge-locked {
    background: var(--gray-light);
    color: var(--gray);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0.6;
    border: 1px solid var(--border);
}

.roster-premium-table {
    border: none !important;
}

.roster-premium-table th {
    background: white !important;
    border-bottom: 2px solid #f0f0f0 !important;
    padding: 16px !important;
}

.roster-premium-table tr:hover {
    background: #f9f9fb;
}

.roster-premium-table td {
    padding: 16px !important;
    border-bottom: 1px solid #f4f4f7 !important;
}

.roster-premium-table .p-name {
    color: var(--text-black);
    font-size: 0.95rem;
}

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

/* --- Banner --- */
.draft-banner {
    background: linear-gradient(135deg, #ff3b30 0%, #ff2d55 100%);
    color: white;
    padding: 20px 24px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: 0 10px 20px rgba(255, 59, 48, 0.2);
    animation: pulse-border 2s infinite;
}

.draft-banner h4 {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
}

.draft-banner p {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.9;
    margin: 4px 0 0 0;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 59, 48, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 800px;
    }

    .roster-grid-large {
        grid-template-columns: 1fr 1fr;
    }
}