/*
 * Bracket View Styles
 * Customizes brackets-viewer for IBrackit
 */

/* Container override for bracket pages */
.container--wide {
    max-width: 100% !important;
    padding: 0 var(--space-sm);
}

/* brackets-viewer theme */
.brackets-viewer {
    /* Colors - match IBrackit theme */
    --primary-background: #1a1a1a;
    --secondary-background: #222222;
    --match-background: var(--primary-background);
    --font-color: #e8e8e8;
    --win-color: #4caf50;
    --loss-color: #ef5350;
    --label-color: #999999;
    --hint-color: #999999;
    --connector-color: #666666;
    --border-color: #444444;
    --border-hover-color: #f28d30;

    /* Sizes - mobile friendly */
    --text-size: 12px;
    --round-margin: 24px;
    --match-width: 140px;
    --match-horizontal-padding: 8px;
    --match-vertical-padding: 6px;
    --connector-border-width: 2px;
    --match-border-width: 1px;
    --match-border-radius: 4px;

    max-width: none;
    width: 100%;
}

/* Bracket container - horizontal scroll on mobile */
#bracket-container {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-md);
}

.brackets-viewer {
    display: flex;
    flex-direction: row;
    width: max-content;
    min-width: 100%;
}

.bracket-item {
    flex: 0 0 auto;
    margin-right: var(--space-sm);
}

/* Score modal - mobile optimized */
#score-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #1a1a1a;
    border: 2px solid #f28d30;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: calc(100% - 32px);
    max-width: 320px;
    max-height: 90vh;
    overflow-y: auto;
}

#score-modal h3 {
    margin: 0 0 12px;
    color: #f28d30;
    font-size: 18px;
}

#score-modal hr {
    border: none;
    border-top: 1px solid #333;
    margin: 12px 0;
}

#score-modal form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#score-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#score-modal label {
    color: #e8e8e8;
    font-size: 14px;
    font-weight: 600;
}

#score-modal input[type="number"],
#score-modal select {
    width: 100%;
    min-height: 44px;
    background: #2a2a2a;
    color: #e8e8e8;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 16px; /* Prevents iOS zoom */
    -webkit-appearance: none;
}

#score-modal input[type="number"]:focus,
#score-modal select:focus {
    outline: none;
    border-color: #f28d30;
    box-shadow: 0 0 0 3px rgba(242, 141, 48, 0.2);
}

#score-modal button {
    min-height: 44px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    -webkit-tap-highlight-color: transparent;
}

#score-modal button[type="submit"] {
    background: #f28d30;
    color: #1a1a1a;
}

#score-modal button[type="submit"]:hover {
    background: #ff9d40;
}

#score-modal button[type="button"] {
    background: #333;
    color: #e8e8e8;
    border: 1px solid #444;
}

#score-modal button[type="button"]:hover {
    background: #444;
}

/* Highlight for search (temporary) */
.highlight-participant {
    outline: 3px solid #f28d30 !important;
    outline-offset: 2px;
    background-color: rgba(242, 141, 48, 0.2) !important;
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Watch Player - persistent highlight */
.watched-participant {
    outline: 3px solid #4caf50 !important;
    outline-offset: 2px;
    background-color: rgba(76, 175, 80, 0.15) !important;
    position: relative;
}

/* My Match - checked-in player's matches */
.my-match.participant,
.match.my-match .participant[data-participant-id] {
    outline: 3px solid #2196f3 !important;
    outline-offset: 2px;
    background-color: rgba(33, 150, 243, 0.2) !important;
}

/* Check-in status styling */
#checkin-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm, 8px);
    flex-wrap: wrap;
}

/* Report panel styling */
#report-panel {
    background: var(--color-bg-secondary, #222);
    border-left: 4px solid #2196f3;
}

#report-panel h3 {
    margin-bottom: var(--space-sm, 8px);
}

.match-label {
    font-size: 1.1em;
    margin-bottom: var(--space-md, 16px);
}

#report-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md, 16px);
}

#report-form .score-inputs {
    display: flex;
    gap: var(--space-md, 16px);
    flex-wrap: wrap;
}

#report-form .form-group {
    flex: 1;
    min-width: 100px;
}

#report-form .score-input {
    width: 100%;
    font-size: 1.25rem;
    text-align: center;
    padding: var(--space-sm, 8px);
}

.text-error {
    color: var(--color-error, #ef5350);
}

.text-success {
    color: var(--color-success, #4caf50);
}

/* Bracket header - compact layout */
.bracket-header-box {
    padding: var(--space-sm, 8px) var(--space-md, 16px);
}

.bracket-header-box h1 {
    font-size: 1.25rem;
    margin: 0;
}

.bracket-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm, 8px);
    flex-wrap: wrap;
}

.bracket-header-actions {
    display: flex;
    gap: var(--space-xs, 4px);
    align-items: center;
    flex-wrap: wrap;
}

#toggle-controls-btn {
    min-width: 70px;
}

#toggle-icon {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 10px;
}

.bracket-controls:not(.collapsed) ~ .bracket-header-row #toggle-icon,
#toggle-icon.expanded {
    transform: rotate(180deg);
}

/* Bracket controls layout - collapsible */
.bracket-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm, 8px);
    align-items: flex-end;
    margin-top: var(--space-sm, 8px);
    padding-top: var(--space-sm, 8px);
    border-top: 1px solid #333;
    overflow: hidden;
    max-height: 200px;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.3s ease, padding 0.3s ease;
}

.bracket-controls.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.bracket-control-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bracket-control-group label {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bracket-control-group small {
    margin-top: 2px;
    font-size: 10px;
}

.bracket-control-group input[type="text"] {
    height: 28px;
    padding: 4px 8px;
    font-size: 12px;
}

/* Simple nav link above bracket */
.bracket-nav-link {
    padding: var(--space-xs, 4px) var(--space-sm, 8px);
    font-size: 12px;
}

.bracket-nav-link a {
    color: #999;
    text-decoration: none;
    transition: color 0.15s ease;
}

.bracket-nav-link a:hover {
    color: #f28d30;
}

/* Dark theme class */
.dark-theme {
    background: #1a1a1a;
}

/* Activity Feed - Pending Reports */
.activity-feed {
    border-left: 4px solid #f28d30;
}

.activity-feed h3 {
    margin-bottom: var(--space-md, 16px);
    color: #f28d30;
}

.feed-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 8px);
}

.feed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md, 16px);
    padding: var(--space-sm, 8px) var(--space-md, 16px);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    flex-wrap: wrap;
}

.feed-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm, 8px);
    flex-wrap: wrap;
}

.feed-reporter {
    color: #e8e8e8;
}

.feed-score {
    font-size: 1.1em;
    font-weight: bold;
    color: #4caf50;
    background: rgba(76, 175, 80, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

.feed-status {
    font-size: 0.85em;
}

.feed-actions {
    display: flex;
    gap: var(--space-sm, 8px);
}

.feed-actions .button.small {
    padding: 4px 12px;
    font-size: 12px;
}

/* ====== DRAW CEREMONY ====== */
.ceremony-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.ceremony-overlay.hidden {
    display: none;
}

.ceremony-overlay.fade-out {
    opacity: 0;
}

.ceremony-content {
    text-align: center;
    padding: var(--space-lg, 32px);
    max-width: 800px;
    width: 100%;
}

.ceremony-title {
    font-size: 3rem;
    color: #f28d30;
    margin-bottom: var(--space-sm, 8px);
    text-transform: uppercase;
    letter-spacing: 4px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 10px rgba(242, 141, 48, 0.3); }
    to { text-shadow: 0 0 30px rgba(242, 141, 48, 0.6), 0 0 60px rgba(242, 141, 48, 0.3); }
}

.ceremony-subtitle {
    font-size: 1.2rem;
    color: #999;
    margin-bottom: var(--space-lg, 32px);
}

.ceremony-teams {
    display: flex;
    flex-direction: column;
    gap: var(--space-md, 16px);
    align-items: center;
    max-height: 60vh;
    overflow-y: auto;
    padding: var(--space-md, 16px);
    margin-bottom: var(--space-lg, 32px);
}

.ceremony-team-card {
    background: #2a2a2a;
    border: 2px solid #444;
    border-radius: 8px;
    padding: var(--space-md, 16px) var(--space-lg, 32px);
    min-width: 220px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-md, 16px);
    opacity: 0;
    transform: translateY(30px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ceremony-team-card.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: #f28d30;
    box-shadow: 0 4px 20px rgba(242, 141, 48, 0.2);
}

.ceremony-team-card .team-number {
    background: #f28d30;
    color: #1a1a1a;
    font-weight: bold;
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 4px;
}

.ceremony-team-card .team-players {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ceremony-team-card .team-player {
    font-size: 1.1rem;
    color: #e8e8e8;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.3s ease-out;
}

.ceremony-team-card .team-player.revealed {
    opacity: 1;
    transform: translateX(0);
}

.ceremony-team-card .team-label {
    font-size: 0.85rem;
    color: #f28d30;
    font-weight: 500;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #444;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.ceremony-team-card .team-label.revealed {
    opacity: 1;
}

#ceremony-skip {
    margin-top: var(--space-md, 16px);
    opacity: 0.7;
    transition: opacity 0.2s;
}

#ceremony-skip:hover {
    opacity: 1;
}

/* Desktop adjustments */
@media (min-width: 640px) {
    .brackets-viewer {
        --text-size: 13px;
        --round-margin: 40px;
        --match-width: 160px;
    }

    #score-modal {
        padding: 20px;
        max-width: 360px;
    }

    /* Ceremony desktop */
    .ceremony-title {
        font-size: 4rem;
    }

    .ceremony-team-card {
        min-width: 260px;
        padding: var(--space-lg, 32px);
    }

    .ceremony-team-card .team-player {
        font-size: 1.3rem;
    }
}
