/* --- Design Tokens --- */
:root {
    /* Colors - Dark Premium Theme */
    --bg-base: #0a0c10;
    --bg-surface: #12161f;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: #8b949e;

    /* Accents */
    --accent-primary: #00e676;
    /* Neon Green */
    --accent-hover: #00c853;
    --accent-danger: #ea4335;
    --accent-danger-hover: #c5221f;
    --accent-blue: #2979ff;

    /* Pitch */
    --pitch-bg: linear-gradient(0deg, #1b5e20 0%, #2e7d32 100%);
    --pitch-lines: rgba(255, 255, 255, 0.4);

    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Effects */
    --glass-bg: rgba(18, 22, 31, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 230, 118, 0.15);
}

/* --- Resets & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(0, 230, 118, 0.03), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(41, 121, 255, 0.03), transparent 25%);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* --- Layout --- */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    padding: 130px 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
}

/* --- Navigation (Glassmorphism) --- */
.glass-nav {
    position: fixed;
    top: 0;
    width: 100%;
    height: 100px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.nav-brand ion-icon {
    color: var(--accent-primary);
    font-size: 1.8rem;
}

.nav-brand img {
    height: 90px;
    width: auto;
    object-fit: contain;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--accent-primary);
    background: rgba(0, 230, 118, 0.1);
}

.user-budget {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    border: 1px solid var(--glass-border);
}

.user-budget ion-icon {
    color: var(--accent-primary);
}

/* --- Views & Routing --- */
.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active-view {
    display: block;
}

.auth-fullscreen.active-view {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

/* --- Cards & Glassmorphism --- */
.glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

/* --- Auth View --- */
.login-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 30px;
}

.tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group ion-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
}

.input-group input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 230, 118, 0.2);
    background: rgba(0, 0, 0, 0.5);
}

/* --- Buttons --- */
.btn {
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: #000;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--accent-danger);
    padding: 8px 16px;
}

.btn-outline-danger:hover {
    border-color: var(--accent-danger);
    background: rgba(234, 67, 53, 0.1);
}

.btn-lg {
    font-size: 1.1rem;
    padding: 16px 32px;
    letter-spacing: 0.5px;
}

.w-100 {
    width: 100%;
}

/* --- Dashboard / Header --- */
.view-header {
    margin-bottom: 30px;
    text-align: center;
}

.view-header h2 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #fff, var(--text-secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.budget-card {
    background: rgba(0, 230, 118, 0.05);
    border: 1px solid rgba(0, 230, 118, 0.2);
    padding: 20px 30px;
    border-radius: 16px;
    text-align: right;
}

.budget-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.budget-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-primary);
}

/* --- The Pitch (Field) --- */
.team-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* Dashboard two-column grid */
.dash-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 24px;
    align-items: start;
}

.dash-pitch-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dash-sidebar-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Live match pulse animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.live-banner {
    border: 1px solid #ff5370 !important;
}

.pitch {
    position: relative;
    width: 300px;
    height: 400px;
    background: var(--pitch-bg);
    border-radius: 12px;
    border: 2px solid var(--pitch-lines);
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transform: perspective(1000px) rotateX(10deg);
    transform-origin: top;
    transition: transform 0.5s ease;
}

.pitch:hover {
    transform: perspective(1000px) rotateX(5deg);
}

.center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75px;
    height: 75px;
    border: 2px solid var(--pitch-lines);
    border-radius: 50%;
}

.center-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -2px;
    right: -2px;
    height: 2px;
    background: var(--pitch-lines);
    transform: translateY(-50%);
}

.penalty-box {
    position: absolute;
    width: 150px;
    height: 60px;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid var(--pitch-lines);
}

.penalty-box.top {
    top: -2px;
    border-top: none;
}

.penalty-box.bottom {
    bottom: -2px;
    border-bottom: none;
}

/* Pitch Players Positioning Wrapper */
.pitch-players {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 20px;
}

.pitch-row {
    display: flex;
    justify-content: space-around;
    width: 100%;
}

/* Player Token on Pitch */
.player-token {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.player-token:hover {
    transform: scale(1.1);
}

.token-shirt {
    width: 48px;
    height: 48px;
    background: var(--bg-surface);
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 6px;
    position: relative;
}

.token-shirt img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.token-shirt .remove-icon {
    position: absolute;
    inset: 0;
    background: rgba(234, 67, 53, 0.8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 1.5rem;
}

.player-token:hover .remove-icon {
    opacity: 1;
}

.token-info {
    background: rgba(0, 0, 0, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
}

.token-name {
    font-size: 0.8rem;
    font-weight: 600;
    display: block;
    white-space: nowrap;
}

.token-points {
    font-size: 0.75rem;
    color: var(--accent-primary);
}

/* Empty Token slot */
.token-empty {
    width: 48px;
    height: 48px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s;
}

.token-empty:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(0, 230, 118, 0.1);
}

.actions-bar {
    display: flex;
    justify-content: center;
    padding: 20px;
}

/* --- Market View --- */
.filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
    font-weight: 600;
}

.market-status {
    display: flex;
    justify-content: space-between;
    background: var(--glass-bg);
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid var(--glass-border);
}

.text-accent {
    color: var(--accent-primary);
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.player-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.player-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.player-card img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.player-details {
    flex: 1;
}

.player-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.player-meta {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.pos-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.75rem;
}

.player-stats {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.player-price {
    color: #fbbc04;
}

.player-pts {
    color: var(--accent-blue);
}

.btn-add {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 230, 118, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 230, 118, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add:hover {
    background: var(--accent-primary);
    color: #000;
}

.btn-add.added {
    background: rgba(234, 67, 53, 0.1);
    color: var(--accent-danger);
    border-color: rgba(234, 67, 53, 0.2);
}

.btn-add.added:hover {
    background: var(--accent-danger);
    color: #fff;
}

/* --- Leaderboard View --- */
.leaderboard-container {
    padding: 0;
}

.leaderboard-header,
.leaderboard-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px;
    padding: 20px 30px;
    align-items: center;
}

.leaderboard-header {
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.leaderboard-list {
    list-style: none;
}

.leaderboard-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

.leaderboard-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.rank-badge {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.rank-1 .rank-badge {
    background: #ffd700;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.rank-2 .rank-badge {
    background: #c0c0c0;
    color: #000;
}

.rank-3 .rank-badge {
    background: #cd7f32;
    color: #000;
}

.lb-user-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-primary);
}

.lb-user {
    font-weight: 600;
    font-size: 1.1rem;
}

.lb-pts {
    font-weight: 800;
    color: var(--accent-primary);
    text-align: right;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    color: white;
    padding: 16px 32px;
    border-radius: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 2000;
    font-weight: 500;
}

.toast.show {
    bottom: 40px;
}

/* --- Utility Classes & Animations --- */
.error-msg {
    color: var(--accent-danger);
    font-size: 0.9rem;
    margin-bottom: 15px;
    min-height: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-slide-up {
    animation: slideUp 0.5s ease forwards;
}

.delay-1 {
    animation-delay: 0.1s;
    opacity: 0;
}

.delay-2 {
    animation-delay: 0.2s;
    opacity: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .glass-nav {
        padding: 0 20px;
    }

    .nav-links {
        gap: 10px;
    }

    .nav-item {
        padding: 8px;
        font-size: 0.9rem;
    }

    .nav-brand span {
        display: none;
    }

    .user-budget span,
    #logout-btn {
        display: none;
    }

    .pitch {
        width: 100%;
        height: 600px;
    }

    .token-shirt {
        width: 36px;
        height: 36px;
    }

    .token-empty {
        width: 36px;
        height: 36px;
    }

    .token-name {
        font-size: 0.7rem;
    }
}

/* --- Banner Slider --- */
.banner-container {
    position: relative;
    width: 100%;
    height: 320px;
    margin-bottom: 30px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--bg-surface);
    display: none;
    /* Hidden until loaded */
}

.banner-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.banner-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: flex;
    align-items: center;
    background-size: cover;
    background-position: center;
}

.banner-slide.active {
    opacity: 1;
    z-index: 1;
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(10, 12, 16, 0.8) 0%, rgba(10, 12, 16, 0.3) 100%);
    padding: 0 20px 45px;
    /* Lower positioning closer to dots */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-align: center;
    z-index: 2;
}

.banner-content {
    max-width: 500px;
}

.banner-title {
    font-size: 3.2rem;
    font-weight: 800;
    margin-bottom: 5px;
    color: #fff;
    line-height: 1.0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.banner-desc {
    font-size: 1.1rem;
    color: #ccc;
    margin-bottom: 12px;
    /* Shortened gap to button */
    line-height: 1.5;
}

.banner-btn {
    background: #ffb74d !important;
    /* Laranja Claro */
    color: #000 !important;
}

.banner-btn:hover {
    background: #ffa726 !important;
    box-shadow: 0 0 20px rgba(255, 183, 77, 0.3) !important;
}

.banner-dots {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: var(--accent-primary);
    width: 24px;
    border-radius: 4px;
}

/* --- Profile Nav Header --- */
.profile-nav {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-right: 12px;
    cursor: pointer;
    border: 2px solid var(--accent-primary);
    overflow: hidden;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-nav:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.3);
}

.nav-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

/* --- Profile Settings View --- */
.profile-avatar-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
}

.error-msg {
    color: var(--accent-danger);
    font-size: 0.9rem;
    margin: 10px 0;
    text-align: center;
}