:root {
    --bg: #0a0a0a;
    --card-bg: #0f0f0f;
    --border: rgba(255, 255, 255, 0.1);
    --red-primary: #dc2626;
    --red-glow: rgba(220, 38, 38, 0.5);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.4);
    --yellow: #eab308;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 0 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    background: linear-gradient(135deg, #dc2626, #7f1d1d);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 0 15px var(--red-glow);
    display: flex;
}

.logo-icon i {
    width: 20px;
    height: 20px;
}

h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.gradient-text {
    background: linear-gradient(to right, #ef4444, #b91c1c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

nav {
    position: absolute;
    right: 1rem;
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 68, 68, 0.1);
    color: #ef4444;
}

.nav-btn.active {
    background: rgba(255, 68, 68, 0.1);
    color: #ef4444;
}

.btn-icon {
    width: 14px;
    height: 14px;
}

/* Main Content */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    height: calc(100vh - 64px);
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

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

/* Bracket Styles */
.bracket-card {
    background: radial-gradient(ellipse at center, rgba(17, 24, 39, 0.5), #0a0a0a);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    height: 100%;
    overflow: hidden;
    position: relative;
}

.bracket-container {
    height: 100%;
    overflow: auto;
    position: relative;
    padding: 3rem;
}

#bracketSvg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.bracket-columns {
    display: flex;
    gap: 4rem;
    position: relative;
    z-index: 10;
    min-width: max-content;
    height: 100%;
}

.column {
    display: flex;
    flex-direction: column;
    min-width: 160px;
}

.column-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(255,255,255,0.3);
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 8px;
    margin-bottom: 16px;
    font-weight: 700;
}

.match-list {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
    gap: 16px;
}

.team-card {
    background: rgba(23, 23, 23, 0.8);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    position: relative;
    transition: all 0.3s;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.team-name {
    flex: 1;
}

.team-score {
    font-weight: 700;
    color: #eab308;
    background: rgba(234, 179, 8, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    min-width: 32px;
    text-align: center;
}

.team-card.filled {
    background: linear-gradient(to right, #171717, #262626);
    border-color: rgba(220, 38, 38, 0.3);
    color: white;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.1);
}

.team-card.filled .team-name {
    color: white;
}

.team-card.filled .team-score {
    color: #fef08a;
}

.team-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ef4444;
    opacity: 0;
    transition: opacity 0.3s;
}

.team-card:hover::before {
    opacity: 1;
}

.champion-column {
    justify-content: center;
    align-items: center;
    margin-left: 2rem;
}

.champion-icon-container {
    margin-bottom: 1.5rem;
    animation: pulse 2s infinite;
}

.champ-icon {
    width: 64px;
    height: 64px;
    color: var(--yellow);
    filter: drop-shadow(0 0 20px rgba(234, 179, 8, 0.6));
}

.champ-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(234, 179, 8, 0.6);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.champion-display {
    padding: 1rem 2rem;
    background: linear-gradient(to bottom, rgba(234, 179, 8, 0.1), rgba(0,0,0,0.5));
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #facc15;
    box-shadow: 0 0 30px rgba(234, 179, 8, 0.15);
    min-width: 200px;
    text-align: center;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Admin Styles */
.admin-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 90%;
    position: relative;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.card-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.save-btn, .logout-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
}

.logout-btn:hover {
    background: rgba(255,255,255,0.1);
}

.save-btn:hover {
    background: #b91c1c;
}

.save-btn i, .logout-btn i {
    width: 16px;
    height: 16px;
}

.card-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ef4444;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
}

.section-title i {
    width: 14px;
    height: 14px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-row-qf, .input-row-sf, .input-row-f {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-num {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.2);
    font-family: monospace;
    width: 24px;
}

input[type="text"], input[type="password"] {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    transition: all 0.2s;
    outline: none;
}

input[type="text"]:focus, input[type="password"]:focus {
    background: rgba(220, 38, 38, 0.05);
    border-color: rgba(220, 38, 38, 0.5);
}

.score-input {
    width: 70px !important;
    font-weight: 700;
    text-align: center;
    font-family: monospace !important;
}

.admin-column-wide {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.final-section {
    background: linear-gradient(to bottom right, rgba(127, 29, 29, 0.1), black);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.finalist-title {
    color: #f87171;
}

.final-section input {
    background: rgba(0,0,0,0.4);
    border-color: rgba(239, 68, 68, 0.2);
}

.champion-input-wrapper {
    border-top: 1px solid rgba(239, 68, 68, 0.2);
    padding-top: 1.5rem;
}

.champion-title {
    color: var(--yellow);
}

.champ-input {
    background: rgba(234, 179, 8, 0.1) !important;
    border-color: rgba(234, 179, 8, 0.3) !important;
    color: #fef08a !important;
    text-align: center;
    font-weight: 700;
    height: 40px;
}

/* Login Styles */
.login-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.login-card {
    background: #111;
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 16px;
    text-align: center;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
}

.login-icon {
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--red-primary);
}

.login-card h2 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.login-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.password-input-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.password-input-wrapper input {
    padding: 12px 40px 12px 12px;
    font-size: 1rem;
    background: rgba(0,0,0,0.3);
    border-color: var(--border);
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
}

.login-btn {
    width: 100%;
    background: var(--red-primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.login-btn:hover {
    background: #b91c1c;
    transform: translateY(-2px);
}

.error-msg {
    color: #ef4444;
    font-size: 0.875rem;
    min-height: 20px;
    margin-bottom: 1rem;
}

.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Responsive */
@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .header-inner {
        justify-content: space-between;
    }
    
    nav {
        position: static;
    }
    
    .logo-area h1 {
        display: none;
    }
    
    .logo-area h1 span {
        display: inline;
    }
}
