@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #060713;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    
    --color-primary: #7c3aed;
    --color-primary-glow: rgba(124, 58, 237, 0.4);
    --color-success: #10b981;
    --color-success-glow: rgba(16, 185, 129, 0.3);
    --color-warning: #f59e0b;
    --color-warning-glow: rgba(245, 158, 11, 0.3);
    --color-danger: #ef4444;
    --color-danger-glow: rgba(239, 68, 68, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 1rem 1rem 3rem 1rem;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #fff 30%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.2rem;
}

header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Sync Banner */
.sync-banner {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    backdrop-filter: blur(10px);
}

.sync-banner-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.sync-badge {
    background: var(--color-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.btn-sync {
    background: var(--color-primary);
    border: none;
    color: white;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px var(--color-primary-glow);
    transition: all 0.2s ease;
}

.btn-sync:active {
    transform: scale(0.95);
}

.last-match-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 0.3rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Header & Uruguay Status Card */
.uruguay-status-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
    backdrop-filter: blur(12px);
    margin-bottom: 1.5rem;
    text-align: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.uruguay-status-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-primary);
    transition: background 0.5s ease;
}

/* Dynamic status styles */
.uruguay-status-card.direct-qualified {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 10px 30px var(--color-success-glow);
}
.uruguay-status-card.direct-qualified::before {
    background: var(--color-success);
}

.uruguay-status-card.third-qualified {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 10px 30px var(--color-success-glow);
    border-style: dashed;
}
.uruguay-status-card.third-qualified::before {
    background: var(--color-success);
}

.uruguay-status-card.in-danger {
    border-color: rgba(245, 158, 11, 0.4);
    box-shadow: 0 10px 30px var(--color-warning-glow);
}
.uruguay-status-card.in-danger::before {
    background: var(--color-warning);
}

.uruguay-status-card.eliminated {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 10px 30px var(--color-danger-glow);
}
.uruguay-status-card.eliminated::before {
    background: var(--color-danger);
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.8rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.badge-direct {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-third {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px dashed rgba(16, 185, 129, 0.4);
}

.badge-danger {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-eliminated {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-team-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.status-flag {
    width: 32px;
    height: 22px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.status-team-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.status-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 500px;
    margin: 0 auto;
}

/* Quick Match Simulator Card */
.quick-simulator-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.25rem;
    backdrop-filter: blur(12px);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.card-title-icon {
    color: var(--color-primary);
}

.quick-matches-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 0.3rem;
}

/* Scrollbar styling */
.quick-matches-grid::-webkit-scrollbar {
    width: 4px;
}
.quick-matches-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}
.quick-matches-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

@media(min-width: 600px) {
    .quick-matches-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Single Match Layout */
.match-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.match-info-top {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
}

.match-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.match-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 35%;
}

.match-team.team-home {
    justify-content: flex-end;
    text-align: right;
}

.match-team.team-away {
    justify-content: flex-start;
    text-align: left;
}

.match-team span {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-flag {
    width: 22px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Tappable Score Controls */
.score-inputs-wrapper {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    justify-content: center;
    width: 30%;
}

.score-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.btn-adjust {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-primary);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-adjust:hover {
    background: var(--color-primary);
}

.btn-adjust:active {
    transform: scale(0.85);
}

.score-input {
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: center;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 700;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
    margin: 0.2rem 0;
    -moz-appearance: textfield;
}

.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.score-input:focus {
    border-color: var(--color-primary);
}

.score-separator {
    color: var(--text-secondary);
    font-weight: bold;
    font-size: 0.9rem;
    margin: 0 0.1rem;
}

/* Match Played Styles (Locked) */
.match-card.match-played {
    background: rgba(16, 185, 129, 0.02);
    border-color: rgba(16, 185, 129, 0.1);
}

.match-card.match-played .btn-adjust {
    display: none;
}

.match-card.match-played .score-input {
    background: transparent;
    border: none;
    pointer-events: none;
    font-size: 1.1rem;
    color: var(--color-success);
    width: 20px;
    margin: 0;
}

/* Tabs & Table Styles */
.tabs-container {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.25rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 0;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-align: center;
}

.tab-btn.active {
    background: var(--color-primary);
    color: var(--text-primary);
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Premium Table Styling */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

th, td {
    padding: 0.75rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

td {
    font-weight: 500;
}

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

.table-team {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-team .team-name {
    font-weight: 600;
    white-space: nowrap;
}

/* Best Thirds Specific Colors */
.row-qualifying {
    background: rgba(16, 185, 129, 0.02);
}

.row-qualifying td {
    border-left: 3px solid var(--color-success);
}

.row-eliminated {
    background: rgba(239, 68, 68, 0.02);
    opacity: 0.65;
}

.row-eliminated td {
    border-left: 3px solid var(--color-danger);
}

.row-uruguay {
    background: rgba(124, 58, 237, 0.15) !important;
}

.row-uruguay td {
    border-left: 3px solid #60a5fa !important;
}

.qualification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot-success {
    background: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.dot-danger {
    background: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

/* Accordion Groups Style */
.group-accordion {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 0.8rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.group-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
}

.group-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.group-header-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.group-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.group-badge-summary {
    display: flex;
    gap: 0.3rem;
}

.mini-flag-badge {
    width: 16px;
    height: 11px;
    object-fit: cover;
    border-radius: 1px;
    opacity: 0.7;
}

.accordion-arrow {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.group-accordion.open .accordion-arrow {
    transform: rotate(180deg);
}

.group-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
    padding: 0 1rem;
}

.group-accordion.open .group-content {
    max-height: 2000px;
    padding: 0 1rem 1rem 1rem;
    transition: max-height 0.4s ease-in-out;
}

.group-matches-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 1rem 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-matches-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

@media(min-width: 600px) {
    .group-matches-list {
        grid-template-columns: 1fr 1fr;
    }
}

/* Reset buttons */
.btn-reset-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

@media(min-width: 500px) {
    .btn-reset-container {
        flex-direction: row;
        justify-content: center;
    }
}

.btn-reset {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-reset-sims {
    background: rgba(124, 58, 237, 0.05);
    border-color: rgba(124, 58, 237, 0.15);
    color: #a78bfa;
}

.btn-reset-sims:hover {
    background: rgba(124, 58, 237, 0.15) !important;
    color: white !important;
}

.btn-reset:active {
    transform: scale(0.97);
}

/* Footer */
footer {
    margin-top: 3rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.search-container {
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    border-color: var(--color-primary);
}
