/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-color: #060913;
    --card-bg: rgba(13, 20, 38, 0.6);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-hover-border: rgba(99, 102, 241, 0.35);
    --primary-color: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.15);
    --secondary-color: #0ea5e9; /* Sky Blue */
    --accent-color: #10b981; /* Emerald */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --font-header: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Decorative Glows */
.background-decor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow {
    position: absolute;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.12;
}

.glow-1 {
    top: -10vw;
    right: -10vw;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
}

.glow-2 {
    bottom: -10vw;
    left: -10vw;
    background: radial-gradient(circle, var(--secondary-color) 0%, transparent 70%);
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

/* App Header */
.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-emoji {
    font-size: 2.25rem;
    animation: float 4s ease-in-out infinite;
}

.app-header h1 {
    font-family: var(--font-header);
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header h1 span {
    background: linear-gradient(135deg, #818cf8 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-header .subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Calendar Header Actions Row */
.calendar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.calendar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Pulse indicator for sync status */
.pulse-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-color);
    animation: pulse 2s infinite;
}

.status-text {
    font-family: var(--font-header);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-color);
}

.time-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.time-meta strong {
    color: var(--text-primary);
}

/* Cache Progress Bar */
.progress-container {
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.progress-container.mini {
    height: 3px;
    max-width: 300px;
    margin: 0.35rem auto 0 auto;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    transition: width 1s linear;
}

/* Buttons */
.sync-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    border: none;
}

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

.btn-primary:hover {
    background-color: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Tooltip */
.tooltip {
    visibility: hidden;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    background-color: #0e1322;
    color: #fff;
    text-align: center;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid var(--primary-color);
    box-shadow: 0 5px 12px rgba(0,0,0,0.4);
    opacity: 0;
    transition: all 0.2s ease;
    white-space: nowrap;
    z-index: 10;
}

.tooltip.show {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 0.75rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-header);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.85rem;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Tab Contents */
.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

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

/* Grid Header */
.grid-header {
    margin-bottom: 1.5rem;
}

.grid-header h2 {
    font-family: var(--font-header);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

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

/* Tab 1 Grid (Participants) */
.participants-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

/* Participant Card */
.participant-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 14px;
    padding: 1.25rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.participant-card:hover {
    transform: translateY(-4px);
    border-color: var(--card-hover-border);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.card-header h3 {
    font-family: var(--font-header);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

.avatar-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--primary-glow);
    border: 1px solid var(--card-hover-border);
    border-radius: 50%;
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* Teams List inside Card */
.team-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0;
    font-size: 0.9rem;
}

.team-flag-name {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.flag-icon-img {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.team-name {
    color: var(--text-primary);
}

.team-status {
    font-size: 0.7rem;
    font-family: var(--font-header);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
}

.status-active {
    background-color: rgba(16, 185, 129, 0.08);
    color: var(--accent-color);
}

.status-eliminated {
    background-color: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.team-item.eliminated {
    opacity: 0.4;
}

/* Tab 2: Calendario Layout */
.calendar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-filters {
    display: flex;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.25rem;
    border-radius: 8px;
    gap: 0.25rem;
}

.filter-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-header);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px var(--primary-glow);
}

/* Match Calendar Card Container */
.matches-container {
    display: block;
}

/* Date Grouping Styles */
.date-group {
    margin-bottom: 2.5rem;
    width: 100%;
}

.date-group-title {
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
    padding-left: 0.75rem;
    display: flex;
    align-items: center;
    letter-spacing: -0.02em;
}

.date-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

/* Match Card */
.match-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 14px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    transition: all 0.25s ease;
}

.match-card:hover {
    border-color: var(--card-hover-border);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 0.5rem;
}

.match-date-time {
    color: var(--text-secondary);
}

.match-status-tag {
    font-family: var(--font-header);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.status-future {
    background-color: rgba(99, 102, 241, 0.08);
    color: #a5b4fc;
}

.status-past {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.status-live {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    animation: flash 1.5s infinite;
}

/* Match Board */
.match-board {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.match-team-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 24px;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.owner-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background-color: rgba(255, 255, 255, 0.04);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-weight: 500;
}

.score-cell {
    font-family: var(--font-header);
    font-size: 1.15rem;
    font-weight: 700;
    width: 24px;
    text-align: center;
}

.vs-divider {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    opacity: 0.6;
}

/* Match Footer Link */
.match-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 0.5rem;
}

.fotmob-link {
    color: var(--secondary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.fotmob-link:hover {
    color: #38bdf8;
    text-decoration: underline;
}

/* Loading Placeholder */
.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3.5rem 1.5rem;
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-sync-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--card-border);
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-size: 0.825rem;
    width: 100%;
    max-width: 450px;
}

.footer-sync-info .sync-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-sync-info .time-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.footer-sync-info .divider {
    opacity: 0.3;
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

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

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

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1.25rem 0.75rem;
    }
    .app-header {
        margin-bottom: 1.25rem;
    }
    .app-header h1 {
        font-size: 2rem;
    }
    .calendar-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0.75rem;
    }
    .calendar-filters {
        width: 100%;
        justify-content: center;
        margin-top: 0.25rem;
    }
    .filter-btn {
        flex: 1;
        text-align: center;
    }
    .btn {
        width: 100%;
        padding: 0.65rem 1.25rem;
    }
    .tab-navigation {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }
    .tab-btn {
        font-size: 0.95rem;
        padding: 0.4rem 0.5rem;
        flex: 1;
        justify-content: center;
    }
    .tab-btn.active::after {
        bottom: -0.85rem;
    }
    .grid-header {
        text-align: center;
        margin-bottom: 1rem;
    }
    .calendar-header-row {
        flex-direction: column;
        align-items: stretch;
    }
    .date-group-grid {
        grid-template-columns: 1fr;
    }
    .search-box {
        width: 100%;
    }
}

/* Custom card style for unassigned teams */
.participant-card.unassigned-card {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.01);
}

/* Search Box Styles */
.search-box {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    gap: 0.5rem;
    transition: all 0.25s ease;
    width: 280px;
    box-sizing: border-box;
}

.search-box:focus-within {
    border-color: var(--card-hover-border);
    background-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 10px var(--primary-glow);
}

.search-icon {
    font-size: 0.9rem;
    color: var(--text-secondary);
    pointer-events: none;
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}
