/* tournament.css - Main Manifest */

/* Import Dedicated Styles */
@import 'brackets.css';
@import 'leaderboard.css';
@import 'dashboard.css';

/* --- Shared/Root Definitions --- */
/* Tournament Wrapper (Root) */
/* --- Shared/Root Definitions --- */
/* --- Shared/Root Definitions --- */
/* Tournament Wrapper (Root) */
/* Tournament Wrapper (Root) */
/* Force Modal Parent to NOT create a Stacking Context/Containing Block */
/* Tournament Wrapper (Root) */
/* Force Modal Parent to NOT create a Stacking Context/Containing Block */
.tournament-arena-modal,
.modal-container.tournament-arena-modal {
    transform: none !important;
    animation: none !important;
    perspective: none !important;
    filter: none !important;
    max-height: none !important; /* Ensure it doesn't clip */
    height: 100% !important; /* Fill screen so bottom:0 works */
}
.tournament-arena-container {
    background-color: #0f0f13;
}
.tournament-wrapper {
    position: relative; /* Back to normal flow */
    /* Strategy: Expand into parent (#page-content) padding using negative margins */
    width: auto;
    max-width: 100vw; /* Ensure it never exceeds viewport */
    margin: 0 calc(-1 * var(--spacing-lg)); 
    padding: 0;
    padding-bottom: 60px; /* Space for Fixed Navbar */
    overflow-x: clip; /* Prevent horizontal scroll WITHOUT creating a scroll container */
    overflow-y: visible; /* Allow page expand */
    box-sizing: border-box; /* Include padding in width calculation */
    
    /* Disable gestures that cause dragging/zooming issues on mobile */
    touch-action: pan-x pan-y;
    overscroll-behavior-x: none; /* Prevent horizontal bounce/drift */
    overscroll-behavior-y: auto; /* Allow vertical scroll chaining to body */

    display: flex;
    flex-direction: column;
    
    color: var(--text-primary, #e6edf3);
    font-family: 'Exo 2', sans-serif;
    z-index: 10;
}

/* ... (Keep existing rules) ... */

/* --- Banned Assets Styles --- */
.banned-assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.banned-asset-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid #444;
    border-radius: 8px;
    overflow: hidden;
    cursor: default;
    transition: all 0.2s ease;
}

.banned-asset-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block; 
    max-width: 100%; 
    /* Fix for iOS black image bug: Removing contrast filter */
    filter: grayscale(100%); 
    opacity: 0.6; 
}

/* Disable animation on the Page container to prevent "Fixed Positioning" breakage */
.page.tournament-page-active {
    animation: none !important;
    transform: none !important;
}

.tournament-tabs-bar
{
    display: flex;
    justify-content: space-around;
    align-items: center;
    /* Sticky at bottom of SCROLLING CONTENT */
    position: fixed; /* Back to FIXED so it ignores content height */
    bottom: 0;
    left: 0;
    width: 100%;
    
    flex-shrink: 0;
    height: 60px;
    z-index: 9000;
    
    /* Ensure it has a background to cover content scrolling behind */
    background: var(--bg-dark, #0d1117);
    border-top: 1px solid #30363d;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5); /* Lift it up visually */
    
    font-family: var(--font-body, 'Exo 2', sans-serif);
}

/* Main Content Area - Expands Page */
.tournament-content {
    flex: 1;
    width: 100%;
    overflow: visible; /* No internal scrollbar! */
    padding: 1.5em;
    display: flex;
    flex-direction: column;
}

.tab-link {
    flex: 1;
    text-align: center;
    background: transparent;
    border: none;
    color: #8b949e;
    padding: 20px 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border-top: 3px solid transparent; /* Selection Indicator Top */
    font-family: inherit; /* Inherit var(--font-body) from parent */
}

.tab-link:hover {
    color: #e6edf3;
    background: rgba(255, 255, 255, 0.03);
}

.tab-link.active {
    color: var(--accent-color, #ffa500);
    border-top-color: var(--accent-color, #ffa500);
    background: rgba(var(--accent-rgb, 255,165,0), 0.05);
}

/* brackets.css overrides removed - see brackets.css */

/* --- Main Content Area --- */
.bracket-main-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    /* Force NO Internal Scroll - Rely on Outer Modal/Page Scroll */
    overflow: visible !important; 
}

/* Hide native scrollbar but allow scrolling functionality */
/* .stages-scroll-container moved to brackets.css */

/* --- CUSTOM STICKY SCROLLBAR (Fixed Viewport Bottom) --- */
/* LEGACY SCROLLBAR - HIDDEN FOR SLIDER VIEW */
.bracket-scrollbar-track {
    display: none !important;
}

/* 
.bracket-scrollbar-track {
    position: fixed;
    bottom: 0;
    left: 250px; 
    right: 0;
    
    height: 14px;
    background: #0d1117;
    border-top: 1px solid #30363d;
    
    overflow-x: scroll; 
    overflow-y: hidden;
    z-index: 1000;
    transition: left 0.3s ease;
} 
*/
/* Adjust scrollbar when sidebar is closed */
.bracket-sidebar-wrapper.closed + .bracket-main-area .bracket-scrollbar-track {
    left: 0;
    display: none !important;
}

.bracket-scrollbar-content {
    height: 1px;
    pointer-events: none; 
}

.tournament-content.full-page-content {
    padding: 0;
}

/* Tool Card Span (Global) */
.tool-card.span-2 {
    grid-column: span 2;
    grid-row: span 1;
}

@media (max-width: 768px) {
    .tool-card.span-2 { grid-column: span 2; }
}

@media (max-width: 380px) {
    /* Match layout.css mobile padding change */
    .tournament-wrapper {
        margin: 0 calc(-1 * var(--spacing-md));
    }
}

/* --- Locked Button State (Padlock) --- */
.btn-locked {
    position: relative;
    cursor: not-allowed;
    opacity: 0.7;
    filter: grayscale(0.6);
}

.btn-locked::before {
    content: '🔒';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 1.2rem;
    z-index: 10;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

.btn-locked[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 20;
    pointer-events: none;
    margin-bottom: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* --- Announcement Section --- */
.announcement-container {
    background: rgba(var(--accent-rgb, 255, 153, 0), 0.1);
    border: 1px solid var(--accent-color, #ff9900);
    border-radius: var(--radius-md, 8px);
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.announcement-title {
    font-family: var(--font-header, 'Orbitron', sans-serif);
    color: var(--accent-color, #ff9900);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.announcement-text {
    font-size: 0.85rem;
    color: var(--text-color, #e6edf3);
    line-height: 1.5;
    margin-bottom: 1rem;
    max-width: 800px;
}

.announcement-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

/* --- Rules Modal Styles --- */
.rules-scroll-area {
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
    overscroll-behavior: contain; /* Prevent Page Dragging */
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color, #30363d);
    border-radius: var(--radius-sm, 4px);
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Mobile Rules Adaptation */
@media (max-width: 768px) {
    .rules-scroll-area {
        padding: 0.5rem;
        font-size: 0.85rem;
        max-height: 50vh; /* dynamic height on phone */
    }
    .rules-content-wrapper ul {
        padding-left: 15px; /* Ensure bullets visible */
    }
}

.rules-scroll-area::-webkit-scrollbar {
    width: 8px;
}
.rules-scroll-area::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}
.rules-scroll-area::-webkit-scrollbar-thumb {
    background: var(--accent-color, #ff9900);
    border-radius: 4px;
}
.rules-content-wrapper ul{
    list-style-position: inside; 
    padding-left:0; 
    margin:6px 0;
}
.rules-content-wrapper ul li{
    padding-left: 5px;
}
.rules-content-wrapper h3
{
    margin-bottom: 10px;
}

.rules-ack-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-sm, 4px);
    margin-top: 10px;
    transition: opacity 0.3s;
}

.rules-ack-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Warning Box (Copied from Siege Calc/Global) --- */
.warning-box {
    margin-top: 15px;
    background: rgba(255, 60, 60, 0.1);
    border-left: 3px solid #ff4444;
    padding: 8px 10px;
    border-radius: 4px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-align: left;
}

.warning-icon {
    font-size: 1.2rem;
}

.warning-text strong {
    display: block;
    color: #ff6666;
    font-size: 0.9rem;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.warning-text p {
    color: #ffaaaa;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.3;
}

/* Ensure modal text is centered generally but warning box text is left-aligned */
.custom-modal.warning-modal .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- Avatar Selection Styles --- */
.avatar-option {
    transition: all 0.2s ease;
    box-sizing: border-box;
    border: 2px solid transparent; 
}

.avatar-option:hover {
    transform: scale(1.05);
    border-color: var(--accent-color, #ff9900);
    box-shadow: 0 0 8px rgba(255, 153, 0, 0.3);
}

.avatar-option.selected {
    border-color: var(--accent-color, #ff9900);
    border-width: 3px;
    box-shadow: 0 0 12px rgba(255, 153, 0, 0.5);
    transform: scale(1.05);
}
.avatar-grid
{
    padding: 0.5rem;
}

/*Admin Panel Form*/

.admin-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap; /* Force single row */
}

/* Ensure buttons shrink if space is tight */
.admin-header-actions .btn {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1; /* Distribute space evenly or shrink */
    min-width: 0;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    height: 32px; /* Fixed height for uniformity */
    line-height: 1;
}

.stage-config-row stage-label
{
    margin-bottom: 0;
}


/* --- Admin Panel Form --- */
/* (Block Removed: Duplicate Banned Assets Styles) */

/* Padlock Icon Overlay */
.banned-asset-item::after {
    content: '🔒';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 2px black);
    z-index: 2;
}

/* Styles for the JS-injected icons in Rules Modal */
.banned-icon-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This centers the image and fills the container */
    object-position: center 90%; /* Alternative to translateY for positioning */
    display: block;
}

/* Tooltip on hover for name */
.banned-asset-item:hover::before {
    content: attr(title);
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 0.7rem;
    text-align: center;
    padding: 2px 0;
    z-index: 3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Admin specific: Remove button */
.banned-asset-item .btn-remove-ban {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none; /* Initially hidden */
    transition: opacity 0.2s;
    font-weight: bold;
    z-index: 5;
    cursor: pointer;
}

.admin-mode .banned-asset-item:hover .btn-remove-ban {
    opacity: 1;
    pointer-events: auto;
}

/* Rules Editor Textarea */
.rules-editor-textarea {
    width: 100%;
    min-height: 200px;
    background: #0d1117;
    color: #e6edf3;
    border: 1px solid #30363d;
    padding: 10px;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
}

/* Banned Section in Modal */
.banned-section-title {
    color: #ff6666;
    border-bottom: 1px solid #444;
    margin-top: 20px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    font-size: 1rem;
    text-transform: uppercase;
    font-weight: bold;
}


/* --- Rules Editor Modal --- */
.rules-editor-modal .modal-content {
    background: #121212;
    border: 1px solid #333;
    color: #eee;
}

/* Rich Text Toolbar */
.rich-text-toolbar {
    background: #1e1e1e;
    border-bottom: 1px solid #333;
}
.rt-btn {
    background: #2a2a2a;
    border: 1px solid #333;
    color: #ccc;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 0.9em;
    min-width: 30px;
}
.rt-btn:hover {
    background: #333;
    color: #fff;
}

/* Banned Assets Grid - Small Rounded Squares */
.banned-assets-grid-modern {
    display: grid;
    gap: 8px;
    padding: 5px;
}

.re-ban-item {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #444;
    cursor: default;
    background: #000;
}
.re-ban-item img.re-ban-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.re-ban-item .remove-ban-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: rgba(200, 0, 0, 0.8);
    color: white;
    border: none;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    border-bottom-left-radius: 4px;
}
.re-ban-item:hover .remove-ban-btn {
    opacity: 1;
    pointer-events: auto;
}

/* --- Tournament Multi-Select Modal --- */
#tournament-multiselect-overlay .tms-item {
    position: relative;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 5px;
}
#tournament-multiselect-overlay .tms-item:hover {
    background: #252525;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}
#tournament-multiselect-overlay .tms-item.selected {
    border-color: #4CAF50;
    background: #1a2a1a;
    box-shadow: 0 0 0 1px #4CAF50;
}
#tournament-multiselect-overlay .tms-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    background: #000;
}
#tournament-multiselect-overlay .tms-img-wrapper .tms-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#tournament-multiselect-overlay .tms-check-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #4CAF50;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
#tournament-multiselect-overlay .tms-item.selected .tms-check-indicator {
    display: block;
}
#tournament-multiselect-overlay .tms-item-name {
    font-size: 0.85em;
    padding: 4px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
}
#tournament-multiselect-overlay .tms-item.selected .tms-item-name {
    color: #4CAF50;
    font-weight: bold;
}
/* --- Rules Editor Full Screen Mode --- */
.tournament-wrapper.rules-editor-wrapper {
    padding-bottom: 0 !important;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll */
}

.tournament-content.rules-editor-mode {
    height: 100%;
    overflow: hidden; /* Editor handles its own scroll */
}

/* Ensure editor container fills space */
.rules-editor-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- Specific Modal Overrides --- */

/* Registration Modal */
.custom-overlay.registration-overlay {
    z-index: 10000;
    /* Ensure it has a backdrop if custom-overlay doesn't provide one reliably */
    background: rgba(0, 0, 0, 0.8);
    position: absolute; /* Kept absolute if attached to container context */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto; /* Allow scrolling if content is tall */
    -webkit-overflow-scrolling: touch;
}

/* Rules Modal */
.custom-overlay.rules-overlay {
    /* Rules are attached to container, so absolute is fine */
    background: rgba(0, 0, 0, 0.85); /* Ensure high contrast backdrop */
    z-index: 9999;
    overscroll-behavior: contain;
}

/* Avatar Picker Modal - The "On Top" one */
.custom-overlay.avatar-picker-overlay {
    /* Attached to CONTAINER, so ABSOLUTE to cover container */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20002; /* Top Priority */
    background: rgba(0, 0, 0, 0.85); /* Darker backdrop */
    display: flex;
    justify-content: center;
    align-items: center;
    overscroll-behavior: contain;
}

.custom-modal.avatar-picker-modal {
    background: #161b22;
    border: 1px solid var(--accent-color, #ffa500);
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
}


/*Archives */

#btn-archive-info
{
    top: -60px;
}

#archive-info-modal
{
    padding: 10px;
}
 /* --- End of Tournament Styles --- */

/* --- Archive Banner (Premium - Refined) --- */
.tournament-banner.archive-mode {
    background: linear-gradient(180deg, #0f0f0f 0%, #1a1a1a 100%);
    border-bottom: 1px solid var(--accent-color, #ffa500);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    padding: 15px 0;
    text-align: center;
}

/* Accent Glow Top */
.tournament-banner.archive-mode::after {
    content: '';
    position: absolute;
    top: 0; left: 50%; transform: translateX(-50%);
    width: 60%; height: 1px;
    background: radial-gradient(circle, var(--accent-color, #ffa500) 0%, transparent 70%);
    opacity: 0.5;
}

.tournament-banner.archive-mode .banner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: auto;
}

.tournament-banner.archive-mode h1 {
    font-size: 1.8rem;
    color: var(--accent-color, #ffa500);
    text-shadow: 0 0 10px rgba(255, 165, 0, 0.3);
    margin: 0;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.tournament-banner.archive-mode .archive-subtitle {
    font-size: 0.9rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: normal;
}

.tournament-banner.archive-mode .archive-subtitle strong {
    color: #e6edf3;
    font-weight: 600;
}

.archive-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    background: rgba(var(--accent-rgb, 255, 165, 0), 0.05); /* Very subtle accent tint */
    padding: 5px 20px;
    border-radius: 20px;
    border: 1px solid rgba(var(--accent-rgb, 255, 165, 0), 0.2);
}

.archive-status-text {
    color: var(--accent-color, #ffa500);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.archive-status-text::before {
    content: '●';
    color: var(--accent-color, #ffa500);
    animation: pulseAccent 2s infinite;
}

@keyframes pulseAccent {
    0% { opacity: 0.4; }
    50% { opacity: 1; text-shadow: 0 0 5px var(--accent-color, #ffa500); }
    100% { opacity: 0.4; }
}

.btn-exit-archive {
    background: transparent;
    border: 1px solid var(--accent-color, #ffa500);
    color: var(--accent-color, #ffa500);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.7rem;
    padding: 4px 12px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-exit-archive:hover {
    background: var(--accent-color, #ffa500);
    color: #000;
    box-shadow: 0 0 10px rgba(var(--accent-rgb, 255, 165, 0), 0.4);
}

