/* Global variables */
:root {
    --bg-light: #f8fafc;
    --surface-light: #ffffff;
    --border-color: #e2e8f0;
    --primary-blue: #2563eb;
    --indigo-accent: #4f46e5;
    --text-main: #0f172a;
    --text-muted: #64748b;
}

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

h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-main);
}

/* Navbar Styling */
.navbar-custom {
    background-color: var(--surface-light);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.015);
}

.navbar-brand-gradient {
    font-weight: 800;
    background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* Hero Banner & Slim Lomba Header */
.hero-section {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    padding: 4.5rem 0;
    color: #0f172a;
}

.hero-section h1 {
    font-size: 2.25rem;
    letter-spacing: -0.75px;
}

.hero-section p {
    font-size: 1.05rem;
}

.hero-section::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.08) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    z-index: 1;
    pointer-events: none;
}

.lomba-detail-hero {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 1.25rem 1.75rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
}

.lomba-detail-hero::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.05) 0%, transparent 70%);
    top: -50px;
    right: -50px;
    pointer-events: none;
}

/* Tab Custom Styling with Modern Line Slide Effect */
.nav-tabs-custom {
    border-bottom: 2px solid var(--border-color) !important;
    gap: 1.5rem;
}
.nav-tabs-custom .nav-link {
    border: none !important;
    background: none !important;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.75rem 0.25rem !important;
    position: relative;
    transition: all 0.2s ease;
}
.nav-tabs-custom .nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-blue);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}
.nav-tabs-custom .nav-link.active {
    color: var(--primary-blue) !important;
    background: none !important;
}
.nav-tabs-custom .nav-link.active::after {
    transform: scaleX(1);
    transform-origin: left;
}
.nav-tabs-custom .nav-link:hover {
    color: var(--primary-blue);
    background: none !important;
}
.nav-tabs-custom .nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Card Custom Styling */
.card-custom {
    background-color: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 15px -3px rgba(15, 23, 42, 0.02);
    padding: 1.5rem;
}

.form-control-custom {
    background-color: #f8fafc;
    border: 1.5px solid var(--border-color);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
}

.form-control-custom:focus {
    background-color: var(--surface-light);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    color: var(--text-main);
}

/* Table Custom Styling */
.table-custom {
    border-color: var(--border-color);
    font-size: 0.88rem;
    border-collapse: collapse;
}

.table-custom th {
    background-color: #f8fafc !important;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding: 0.85rem 1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table-custom td {
    vertical-align: middle;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #ffffff !important;
}

.table-custom tbody tr:hover td {
    background-color: #f8fafc !important;
}

/* CSS Bracket Tree rendering in a scrolling viewport */
.bracket-viewport {
    overflow: auto;
    padding: 0.75rem;
    display: flex;
    gap: 1.5rem;
    height: 760px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: #fafbfc;
}

/* Fullscreen API overrides */
.bracket-viewport:fullscreen {
    padding: 2rem;
    background-color: #f8fafc;
    height: 100% !important;
    max-height: none !important;
    border: none;
    border-radius: 0;
}

.bracket-viewport::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.bracket-viewport::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}
.bracket-viewport::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
.bracket-viewport::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    flex: 1 1 0px;
    min-width: 100px;
    max-width: 140px;
    flex-shrink: 1;
    position: relative;
    height: 100%;
}

/* Container wrapper for matches inside round to center them below header */
.round-matches-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1 1 0px;
    position: relative;
}

/* Group containers for pairs of matches (used to connect lines) */
.bracket-match-pair-left,
.bracket-match-pair-right {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    position: relative;
    flex: 1 1 auto;
    padding: 0.5rem 0;
}

/* CONNECTOR LINES - LEFT SIDE */
.bracket-match-pair-left::after {
    content: "";
    position: absolute;
    right: -0.75rem;
    top: 25%;
    bottom: 25%;
    width: 2px;
    background-color: #cbd5e1;
    z-index: 1;
}
.bracket-match-pair-left::before {
    content: "";
    position: absolute;
    right: -1.5rem;
    top: 50%;
    width: 0.75rem;
    height: 2px;
    background-color: #cbd5e1;
    z-index: 1;
}

/* CONNECTOR LINES - RIGHT SIDE */
.bracket-match-pair-right::after {
    content: "";
    position: absolute;
    left: -0.75rem;
    top: 25%;
    bottom: 25%;
    width: 2px;
    background-color: #cbd5e1;
    z-index: 1;
}
.bracket-match-pair-right::before {
    content: "";
    position: absolute;
    left: -1.5rem;
    top: 50%;
    width: 0.75rem;
    height: 2px;
    background-color: #cbd5e1;
    z-index: 1;
}

/* Individual match nodes */
.bracket-match-node {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem 0.4rem;
    margin: 0.2rem 0;
    position: relative;
    box-shadow: 0 1px 3px rgba(15,23,42,0.01);
    transition: all 0.2s ease;
    z-index: 2;
    font-size: 0.65rem;
}

/* Horizontal input line from Left side matches */
.bracket-match-pair-left .bracket-match-node::after {
    content: "";
    position: absolute;
    right: -0.75rem;
    top: 50%;
    width: 0.75rem;
    height: 2px;
    background-color: #cbd5e1;
    z-index: 1;
}

/* Horizontal input line from Right side matches */
.bracket-match-pair-right .bracket-match-node::after {
    content: "";
    position: absolute;
    left: -0.75rem;
    top: 50%;
    width: 0.75rem;
    height: 2px;
    background-color: #cbd5e1;
    z-index: 1;
}

/* Semifinal classes kept for JS selector targeting */
/* Lines are now drawn via SVG in bracket.php script block */


.bracket-match-node:hover {
    border-color: var(--primary-blue);
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(15,23,42,0.04);
}

.bracket-slot {
    font-size: 0.65rem;
    padding: 0.1rem 0.2rem;
    display: flex;
    justify-content: space-between;
    border-radius: 4px;
    margin: 1px 0;
}

.bracket-slot.winner {
    background: rgba(14, 165, 233, 0.08);
    color: #0284c7;
    font-weight: 700;
}

.bracket-slot.empty {
    color: var(--text-muted);
    font-style: italic;
}

.round-header {
    text-align: center;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--primary-blue);
    border-bottom: 1.5px solid var(--border-color);
    padding-bottom: 0.25rem;
    letter-spacing: -0.2px;
    font-size: 0.72rem;
}

/* Match card layout in schedule */
.match-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.01);
}

.match-card:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.04);
}

.match-card.bye {
    opacity: 0.7;
    background-color: #f8fafc;
    border-style: dashed;
}

.team-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    font-size: 0.88rem;
    gap: 0.5rem;
    width: 100%;
}

.team-row span.text-truncate {
    flex: 1;
    min-width: 0;
}

.team-row.winner {
    font-weight: 700;
    color: #0284c7;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--indigo-accent) 100%);
    border: none;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
    transition: all 0.2s ease;
}

.btn-gradient:hover {
    opacity: 0.95;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

/* Leaderboard row styles */
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 1.15rem;
    border-radius: 16px;
    margin-bottom: 0.65rem;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.015);
}

.leaderboard-badge {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    margin-right: 1.25rem;
}

.normal .leaderboard-badge {
    background-color: rgba(0,0,0,0.04);
    color: var(--text-muted);
}

/* Markdown rendering styles */
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    font-weight: 700;
    color: var(--text-main);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}
.markdown-content h1 { font-size: 1.4rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.markdown-content h2 { font-size: 1.2rem; }
.markdown-content h3 { font-size: 1.05rem; }
.markdown-content p {
    margin-bottom: 1rem;
    color: #475569;
}
.markdown-content ul, .markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}
.markdown-content li {
    margin-bottom: 0.25rem;
    color: #475569;
}
.markdown-content pre {
    background-color: #f1f5f9;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}
.markdown-content code {
    font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
    font-size: 0.875rem;
    color: #0f172a;
    background-color: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}
.markdown-content pre code {
    padding: 0;
    background-color: transparent;
    border-radius: 0;
}

/* Stat Cards */
.stat-card {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.01);
}

.stat-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}

.stat-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Login screen styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    padding: 1.5rem;
}

.login-body::before, .login-body::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
}
.login-body::before {
    background-color: #dbeafe;
    top: -100px;
    left: -100px;
}
.login-body::after {
    background-color: #e0e7ff;
    bottom: -100px;
    right: -100px;
}

.login-card {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.02);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.08);
}

.logo-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #eff6ff;
    color: var(--primary-blue);
    width: 60px;
    height: 60px;
    border-radius: 18px;
    margin-bottom: 1.5rem;
}

.login-header h2 {
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.input-group-custom {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.input-group-custom:focus-within {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.input-group-custom input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 0.85rem 1rem 0.85rem 2.75rem;
    color: var(--text-main);
    font-size: 0.95rem;
}

.input-group-custom input:focus {
    outline: none;
    box-shadow: none;
}

.btn-submit {
    background-color: var(--primary-blue);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    padding: 0.85rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-submit:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

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

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary-blue);
}

.alert-danger-custom {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
    color: #991b1b;
    border-radius: 12px;
    font-size: 0.9rem;
    padding: 1rem;
    font-weight: 500;
}

/* Spinner & Lottery Wheel Custom Styles */
.spinner-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.5rem auto;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 0 0 6px #ffffff, 0 0 0 8px var(--border-color);
}

.wheel-canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transition: transform 6s cubic-bezier(0.15, 0.9, 0.25, 1);
    transform: rotate(0deg);
}

.wheel-pointer {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 36px;
    background-color: #ef4444;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    z-index: 10;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}

.wheel-center-pin {
    position: absolute;
    width: 46px;
    height: 46px;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #cbd5e1 100%);
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2), inset 0 2px 4px rgba(255,255,255,0.8);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #1e293b;
    font-size: 0.85rem;
}

.slot-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.slot-badge.available {
    background-color: rgba(37, 99, 235, 0.08);
    color: var(--primary-blue);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.slot-badge.filled {
    background-color: rgba(241, 245, 249, 1);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

/* Spinner Result Overlay & Spin Button Styles */
.overlay-success {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 2rem;
}

.overlay-success.show {
    opacity: 1;
    pointer-events: auto;
}

.spin-result-number {
    font-size: 5rem;
    font-weight: 850;
    line-height: 1;
    margin: 1rem 0 2rem 0;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--indigo-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: scalePulse 2s infinite ease-in-out;
}

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

.btn-spin {
    cursor: pointer;
    border: none;
    background: radial-gradient(circle at 35% 35%, var(--primary-blue) 0%, var(--indigo-accent) 100%);
    color: #ffffff !important;
    font-weight: 850;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-spin:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.4);
}

.btn-spin:active {
    transform: scale(0.95);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
}

.btn-spin:disabled {
    background: #e2e8f0;
    color: #94a3b8 !important;
    box-shadow: none;
    cursor: not-allowed;
}

/* Enhancing Slots Grid */
.slot-box {
    border-radius: 8px;
    padding: 0.35rem 0.25rem;
    transition: all 0.25s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 54px;
}

.slot-box.filled {
    background: rgba(37, 99, 235, 0.04);
    border-color: rgba(37, 99, 235, 0.2);
    color: var(--primary-blue);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.02);
}

.slot-box.empty {
    background: transparent;
    border-style: dashed;
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Gradient Button Styles */
.btn-gradient {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--indigo-accent) 100%);
    color: #ffffff !important;
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-gradient:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-gradient:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Card Custom and Form Styling */
.card-custom {
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.15rem;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.02), 0 8px 16px -6px rgba(15, 23, 42, 0.01);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-custom:hover {
    box-shadow: 0 20px 30px -10px rgba(15, 23, 42, 0.04), 0 10px 20px -8px rgba(15, 23, 42, 0.02);
}

/* Stepper rules list styles */
.rules-step-list {
    background: rgba(248, 250, 252, 0.6);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-color);
}

.rules-step-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.rules-step-item:last-child {
    margin-bottom: 0;
}

.rules-step-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.rules-step-text {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Enhancing standard select styling */
.form-control-custom {
    border-radius: 12px;
    border: 1.5px solid var(--border-color);
    padding: 0.75rem 1rem;
    font-size: 0.92rem;
    transition: all 0.25s ease;
    background-color: var(--surface-light);
    color: var(--text-main);
}

.form-control-custom:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Auto Refresh Spin Animation */
.spin-animation {
    animation: spin-kf 2s linear infinite;
}
@keyframes spin-kf {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom class for Final & Juara 3 Column */
.bracket-round-final {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    flex: 0 0 150px;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
    position: relative;
    height: 100%;
    z-index: 5;
    padding: 0 10px; /* padding-top set dynamically by JS */
    gap: 16px;
}

/* Both Grand Final and Juara 3 cards take full column width */
.bracket-round-final .bracket-match-node {
    width: 100%;
    box-sizing: border-box;
}

/* Premium Leaderboard Styles */
.leaderboard-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}

.podium-card {
    border-radius: 20px !important;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02) !important;
    overflow: visible;
}

.podium-card:hover {
    transform: translateY(-5px) !important;
}

.podium-gold {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important;
    border: 1px solid rgba(251, 191, 36, 0.3) !important;
    box-shadow: 0 12px 30px -8px rgba(251, 191, 36, 0.25) !important;
}

.podium-silver {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 70%, #cbd5e1 100%) !important;
    border: 1px solid rgba(148, 163, 184, 0.4) !important;
    box-shadow: 0 12px 28px -8px rgba(100, 116, 139, 0.25) !important;
}

.podium-bronze {
    background: linear-gradient(135deg, #fffaf5 0%, #ffedd5 100%) !important;
    border: 1px solid rgba(249, 115, 22, 0.2) !important;
    box-shadow: 0 8px 24px -8px rgba(249, 115, 22, 0.15) !important;
}

.leaderboard-card-item {
    background-color: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8) !important;
    border-radius: 14px;
    padding: 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
}

.leaderboard-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(59, 130, 246, 0.2) !important;
}

.border-left-j4 { border-left: 3px solid #f43f5e !important; } /* Rose */
.border-left-sf { border-left: 3px solid #3b82f6 !important; } /* Blue */
.border-left-qf { border-left: 3px solid #6366f1 !important; } /* Indigo */
.border-left-16 { border-left: 3px solid #0d9488 !important; } /* Teal */
.border-left-32 { border-left: 3px solid #64748b !important; } /* Slate */
.border-left-64 { border-left: 3px solid #a1a1aa !important; } /* Zinc */
.border-left-default { border-left: 3px solid #cbd5e1 !important; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 2.5rem 0 !important;
    }
    .hero-section h1 {
        font-size: 1.75rem !important;
    }
    .hero-section p {
        font-size: 0.95rem !important;
    }
    .card-custom {
        padding: 1rem !important;
    }
    
    /* Horizontal tab scrolling on mobile */
    .nav-tabs-custom {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none; /* Firefox */
        gap: 0.75rem;
    }
    .nav-tabs-custom::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    .nav-tabs-custom .nav-item {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Leaderboard podium stacking rules */
    .leaderboard-podium {
        flex-direction: column !important;
        align-items: center !important;
        gap: 1rem !important;
        margin-bottom: 2rem !important;
    }
    .podium-card {
        width: 100% !important;
        max-width: 320px !important;
        height: auto !important;
        transform: none !important;
        padding: 1.25rem 1rem !important;
    }
    .podium-gold {
        order: -1 !important; /* Gold on top */
    }
    .podium-gold .position-absolute {
        top: 0 !important;
        margin-top: -12px !important;
    }
}

@media (max-width: 480px) {
    .navbar-brand-gradient {
        font-size: 1rem !important;
    }
    .login-card {
        padding: 2rem 1.25rem !important;
        border-radius: 16px !important;
    }
    .login-header h2 {
        font-size: 1.5rem !important;
    }
    
    /* Adjust padding on mobile mini */
    .bracket-viewport {
        padding: 0.5rem !important;
        height: 580px !important; /* Slightly shorter on mobile to fit screen */
    }
}

@media (max-width: 340px) {
    /* Extra optimization for mobile mini (<= 320px) */
    .navbar-brand-gradient {
        font-size: 0.9rem !important;
    }
    .navbar-brand img, .navbar-brand div {
        width: 30px !important;
        height: 30px !important;
    }
    .hero-section h1 {
        font-size: 1.45rem !important;
    }
    .card-custom {
        padding: 0.75rem !important;
    }
}
