/* style_tournaments.css - Balanced Tournaments Stylesheet */

/* Notifications Dropdown & Badge Styles */
.notifications-container {
    position: relative;
    z-index: 1000;
}

.notifications-btn {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.notifications-btn:hover {
    color: var(--text-main);
    border-color: rgba(var(--accent-rgb), 0.4);
    background: rgba(var(--accent-rgb), 0.08);
}

.notifications-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    border: 2px solid var(--bg-header);
}

.notifications-dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    background: rgba(var(--bg-surface-rgb), 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    padding: 0.8rem;
    display: none;
    flex-direction: column;
    z-index: 1100;
    animation: dropdownSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notifications-dropdown-menu.active {
    display: flex;
}

.notifications-dropdown-menu .dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
}

.notifications-dropdown-menu .dropdown-header strong {
    font-size: 0.95rem;
    color: var(--heading-color);
}

.mark-all-read-btn {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.mark-all-read-btn:hover {
    color: var(--accent-hover);
}

.notifications-list {
    max-height: 280px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.notification-item {
    display: flex;
    gap: 0.85rem;
    padding: 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.notification-item.unread {
    background: rgba(var(--accent-rgb), 0.05);
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent);
}

.notification-item.unread .notification-icon {
    background: rgba(var(--accent-rgb), 0.1);
}

.notification-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.notification-text {
    font-size: 0.8rem;
    line-height: 1.3;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Dashboard & Cards Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    margin-top: 1rem;
}

.tournaments-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.tournament-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.tournament-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.tournament-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.3s;
}

.tournament-card:hover {
    transform: translateY(-4px);
    border-color: rgba(var(--accent-rgb), 0.3);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

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

.tournament-card.status-finished::before {
    background: var(--text-muted);
}

.tournament-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.tournament-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--heading-color);
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.finished {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.tournament-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tournament-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tournament-card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
}

/* Invitation Banner */
.invitation-banner {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.15) 0%, rgba(var(--accent-rgb), 0.05) 100%);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    animation: pulseBorder 2s infinite alternate;
}

@keyframes pulseBorder {
    0% { border-color: rgba(var(--accent-rgb), 0.2); }
    100% { border-color: rgba(var(--accent-rgb), 0.5); }
}

.invitation-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.35rem;
}

.invitation-actions {
    display: flex;
    gap: 1rem;
}

/* Matchup Scoring Matrix Styles */

/* Constrained scroll wrapper: prevents matrix from expanding page */
.matrix-scroll-wrapper {
    width: 100%;
    max-width: 100%;
    max-height: 500px;
    overflow: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 2.5rem;
    -webkit-overflow-scrolling: touch;
}

/* Legacy alias kept for any remaining references */
.matrix-container {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    max-height: 500px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 2.5rem;
}

.matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
    font-size: 0.85rem;
}

.matrix-table th, .matrix-table td {
    padding: 0.75rem 0.6rem;
    text-align: center;
    border: 1px solid var(--border-color);
    min-width: 80px;
    white-space: nowrap;
}

.matrix-table th {
    background: var(--table-header-bg);
    color: var(--text-muted);
    font-weight: 600;
}

.matrix-table th.deck-header-cell {
    color: var(--heading-color);
    font-weight: 700;
    text-align: left;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sticky first column and header for scrollable matrix */
.matrix-sticky thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--table-header-bg);
}

.matrix-sticky .sticky-col {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bg-surface);
}

.matrix-sticky thead .sticky-col {
    z-index: 3;
}

.matrix-cell-score {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--heading-color);
}

.matrix-cell-score.custom-score {
    color: var(--accent);
}

.matrix-cell-score.scraped-score {
    color: var(--success);
}

.matrix-cell-score.inferred-score {
    color: #a855f7;
}

.matrix-cell-games {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.matrix-table td.self-cell {
    background: rgba(0,0,0,0.2);
    color: var(--text-muted);
    opacity: 0.4;
}

.matrix-table td.editable-cell {
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.matrix-table td.editable-cell:hover {
    background: rgba(var(--accent-rgb), 0.1);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* Standings Table Styles */
.standings-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 2.5rem;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.standings-table th, .standings-table td {
    padding: 1rem 1.25rem;
    text-align: center;
}

.standings-table th {
    background: var(--table-header-bg);
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.standings-table td {
    border-bottom: 1px solid var(--border-color);
}

.standings-table tr:last-child td {
    border-bottom: none;
}

.standings-table tr.row-self td {
    background: rgba(var(--accent-rgb), 0.03);
}

.standings-table td.col-player {
    text-align: left;
    font-weight: 600;
    color: var(--heading-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.position-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    background: rgba(255,255,255,0.05);
}

.position-badge.pos-1 {
    background: #eab308;
    color: #0f0f13;
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.4);
}

.position-badge.pos-2 {
    background: #94a3b8;
    color: #0f0f13;
}

.position-badge.pos-3 {
    background: #b45309;
    color: white;
}

/* Two Column Workspaces */
.tournament-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 100%;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .tournament-workspace {
        grid-template-columns: 2fr 1fr;
    }
}

.workspace-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
}

.workspace-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    min-width: 0;
}

/* Deck Multi Select Grid */
.decks-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(0,0,0,0.1);
}

.deck-checkbox-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.deck-checkbox-card:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
    background: var(--bg-surface-hover);
}

.deck-checkbox-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.deck-checkbox-card.selected {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.05);
}

/* Match history elements */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.match-item-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.match-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.match-item-players {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.player-match-display {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.player-match-display.winner {
    color: var(--heading-color);
    font-weight: 700;
}

.player-match-display.player-right {
    text-align: right;
}

.player-match-name {
    font-size: 0.95rem;
}

.player-match-deck {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.match-score-badge {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    white-space: nowrap;
}

.match-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255,255,255,0.03);
    padding-top: 0.5rem;
    font-size: 0.75rem;
}

.match-points-awarded {
    font-weight: 600;
    color: var(--success);
}

/* Modal and Matrix Custom Score Popups */
.custom-score-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.custom-score-modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    box-shadow: var(--premium-shadow);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.btn-action {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 6px;
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-weight: 500;
}

.btn-action:hover {
    background: var(--accent-hover, #6c429c);
    transform: scale(1.02);
}

.btn-secondary-action {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

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

/* Premium form control inputs & selects styling */
.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: var(--text-main) !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 8px !important;
    font-size: 0.85rem !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    box-shadow: none !important;
}

.form-control:focus {
    outline: none !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6 !important;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    padding-right: 2.25rem !important;
}


