/* ============================================
   SPORT LISBOA E BENFICA - Premium Theme
   ============================================ */

/* --- Variables --- */
:root {
    --benfica-red: #E30613;
    --benfica-dark: #B20000;
    --benfica-deeper: #8B0000;
    --gold: #D4A843;
    --gold-light: #FFD700;
    --bg-dark: #0d0000;
    --bg-card: rgba(20, 0, 0, 0.85);
    --bg-card-hover: rgba(35, 0, 0, 0.9);
    --text-primary: #f5f5f5;
    --text-secondary: #ccc;
    --text-muted: #999;
    --border-subtle: rgba(227, 6, 19, 0.25);
    --shadow-red: rgba(227, 6, 19, 0.15);
    --shadow-red-strong: rgba(227, 6, 19, 0.35);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.3s ease;
}

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

body {
    font-family: 'Montserrat', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-image:
        linear-gradient(175deg, rgba(140, 0, 0, 0.35) 0%, rgba(13, 0, 0, 0.95) 50%, rgba(0, 0, 0, 1) 100%),
        url('https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Est%C3%A1dio_da_Luz_%28aerial_view%29.jpg/1280px-Est%C3%A1dio_da_Luz_%28aerial_view%29.jpg');
    background-size: cover;
    background-attachment: fixed;
    background-position: center top;
    background-repeat: no-repeat;
}

h1, h2, h3, h4 {
    font-family: 'Oswald', 'Segoe UI', Impact, sans-serif;
}

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

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

ul {
    padding-left: 20px;
}

ul li {
    margin-bottom: 10px;
    line-height: 1.6;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 10px rgba(227, 6, 19, 0.5), 0 0 20px rgba(227, 6, 19, 0.3);
    }
    50% {
        text-shadow: 0 0 20px rgba(227, 6, 19, 0.8), 0 0 40px rgba(227, 6, 19, 0.5), 0 0 60px rgba(227, 6, 19, 0.3);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes pulseScale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.03);
    }
}

@keyframes borderGlow {
    0%, 100% {
        border-color: rgba(227, 6, 19, 0.4);
        box-shadow: 0 0 15px var(--shadow-red), inset 0 0 15px rgba(227, 6, 19, 0.05);
    }
    50% {
        border-color: rgba(227, 6, 19, 0.8);
        box-shadow: 0 0 30px var(--shadow-red-strong), inset 0 0 20px rgba(227, 6, 19, 0.1);
    }
}

/* --- Header --- */
header {
    background: linear-gradient(135deg, var(--benfica-red) 0%, var(--benfica-dark) 40%, #1a0000 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    border-bottom: 3px solid var(--gold);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6), 0 2px 10px var(--shadow-red);
    position: relative;
    overflow: hidden;
    animation: fadeInDown 0.6s ease-out;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold-light), var(--gold), var(--gold-light), transparent);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

h1 {
    margin: 0;
    font-size: 2.8em;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
    font-weight: 700;
}

h1 img {
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

header p {
    margin: 10px 0 0;
    font-size: 1.15em;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 300;
    letter-spacing: 1px;
}

h2 {
    color: var(--text-primary);
    border-bottom: 2px solid var(--benfica-red);
    padding-bottom: 12px;
    margin-top: 0;
    font-size: 1.6em;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--gold);
}

h3 {
    letter-spacing: 0.5px;
}

/* --- Navigation --- */
nav {
    background: rgba(10, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 16px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid var(--border-subtle);
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 22px;
    font-weight: 600;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: color var(--transition);
    position: relative;
    padding-bottom: 4px;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--benfica-red);
    transition: all var(--transition);
    transform: translateX(-50%);
}

nav a:hover {
    color: #fff;
}

nav a:hover::after {
    width: 100%;
}

nav a i {
    margin-right: 6px;
}

/* --- Main Container --- */
.container {
    max-width: 960px;
    margin: 40px auto;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 45px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5), 0 0 30px var(--shadow-red);
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    animation: fadeInUp 0.7s ease-out;
}

/* --- Standings Table --- */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 35px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.standings-table th {
    background: linear-gradient(135deg, var(--benfica-red) 0%, var(--benfica-dark) 100%);
    color: white;
    padding: 14px 16px;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.95em;
}

.standings-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
    font-size: 1.05em;
    transition: background var(--transition);
}

.standings-table tbody tr {
    background: rgba(255, 255, 255, 0.03);
}

.standings-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.06);
}

.standings-table tbody tr:hover {
    background: rgba(227, 6, 19, 0.1);
}

.standings-table .benfica-row {
    background: rgba(227, 6, 19, 0.15) !important;
    font-weight: bold;
    color: #ff4d4d;
    border-left: 4px solid var(--benfica-red);
    box-shadow: inset 0 0 20px rgba(227, 6, 19, 0.08);
}

/* --- Match Simulator --- */
.matches-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 10px;
}

.team-column {
    flex: 1;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.04);
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.team-column:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.team-column h3 {
    text-align: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 12px;
    margin-top: 0;
    font-size: 1.2em;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.benfica-col {
    border-top: 4px solid var(--benfica-red);
}

.benfica-col:hover {
    box-shadow: 0 4px 25px rgba(227, 6, 19, 0.2);
}

.sporting-col {
    border-top: 4px solid #008000;
}

.sporting-col:hover {
    box-shadow: 0 4px 25px rgba(0, 128, 0, 0.2);
}

.porto-col {
    border-top: 4px solid #004B9E;
}

.porto-col:hover {
    box-shadow: 0 4px 25px rgba(0, 75, 158, 0.2);
}

.match-card {
    background: rgba(255, 255, 255, 0.05);
    margin-bottom: 8px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all var(--transition);
}

.match-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.opponent-name {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-secondary);
}

.match-select {
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.9em;
    transition: all var(--transition);
    appearance: none;
    -webkit-appearance: none;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ccc' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.match-select:hover {
    border-color: var(--benfica-red);
    box-shadow: 0 0 8px rgba(227, 6, 19, 0.2);
}

.match-select:focus {
    outline: none;
    border-color: var(--benfica-red);
    box-shadow: 0 0 12px rgba(227, 6, 19, 0.3);
}

.match-select option {
    background: #1a0000;
    color: var(--text-primary);
}

/* --- Calculate Button (kept in case re-added) --- */
.calculate-btn {
    display: block;
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--benfica-red) 0%, var(--benfica-dark) 100%);
    color: white;
    border: none;
    font-family: 'Oswald', sans-serif;
    font-size: 1.4em;
    font-weight: 700;
    cursor: pointer;
    margin-top: 30px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 20px rgba(227, 6, 19, 0.4);
    transition: all var(--transition);
}

.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(227, 6, 19, 0.6);
}

.calculate-btn:active {
    transform: translateY(-1px);
}

/* --- Result Area --- */
.result-area {
    margin-top: 0;
    margin-bottom: 40px;
    padding: 35px;
    background: rgba(227, 6, 19, 0.08);
    border: 2px solid rgba(227, 6, 19, 0.4);
    text-align: center;
    border-radius: var(--radius);
    animation: borderGlow 3s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.result-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(227, 6, 19, 0.05), transparent);
    animation: shimmer 4s linear infinite;
}

.champion-text {
    color: var(--benfica-red);
    font-family: 'Oswald', sans-serif;
    font-size: 2.5em;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 2px;
    animation: glow 2s ease-in-out infinite;
}

/* --- Finance Table --- */
.finance-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.finance-table th {
    background: linear-gradient(135deg, var(--benfica-red) 0%, var(--benfica-dark) 100%);
    color: white;
    padding: 14px;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.95em;
}

.finance-table td {
    padding: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: right;
    transition: background var(--transition);
}

.finance-table tbody tr {
    background: rgba(255, 255, 255, 0.03);
}

.finance-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.06);
}

.finance-table tbody tr:hover {
    background: rgba(227, 6, 19, 0.1);
}

.positive {
    color: #4caf50;
    font-weight: bold;
}

.negative {
    color: #ff5252;
    font-weight: bold;
}

/* --- Legends Grid (Palmares) --- */
.legends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 24px;
    margin-top: 30px;
    text-align: center;
}

.legend-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all var(--transition);
}

.legend-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(227, 6, 19, 0.2);
    border-color: var(--border-subtle);
}

.legend-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 12px;
    filter: grayscale(20%);
    transition: filter var(--transition);
}

.legend-card:hover img {
    filter: grayscale(0%);
}

.legend-card p {
    margin: 0;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95em;
}

/* --- Footer --- */
footer {
    background: rgba(5, 0, 0, 0.95);
    color: var(--text-muted);
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    border-top: 1px solid var(--border-subtle);
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

footer p {
    margin: 5px 0;
    font-size: 0.9em;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--benfica-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--benfica-red);
}

/* --- Selection --- */
::selection {
    background: var(--benfica-red);
    color: white;
}

/* --- Responsividade --- */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
        letter-spacing: 1px;
    }

    header {
        padding: 25px 15px;
    }

    header p {
        font-size: 0.95em;
    }

    nav {
        padding: 12px 10px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    nav a {
        margin: 0 8px;
        font-size: 0.8em;
        letter-spacing: 0.5px;
    }

    .container {
        margin: 20px 12px;
        padding: 25px 20px;
        border-radius: var(--radius-sm);
    }

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

    .team-column {
        min-width: unset;
    }

    .champion-text {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.4em;
    }

    h1 img {
        height: 40px !important;
    }

    nav a {
        margin: 0 5px;
        font-size: 0.75em;
    }

    .container {
        padding: 18px 14px;
    }

    .champion-text {
        font-size: 1.4em;
    }

    .standings-table th,
    .standings-table td,
    .finance-table th,
    .finance-table td {
        padding: 8px 6px;
        font-size: 0.85em;
    }
}
