/* Admin Panel Styles */

:root {
    --primary-blue: #1e40af;
    --primary-red: #dc2626;
    --dark: #0f172a;
    --dark-gray: #1e293b;
    --gray: #64748b;
    --light-gray: #f1f5f9;
    --white: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --gradient-primary: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-red) 100%);

    --sidebar-width: 260px;
    --header-height: 70px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-gray);
    color: var(--dark);
}

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Login Screen ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    padding: 2rem;
}

.login-box {
    background: var(--white);
    border-radius: 1rem;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--white);
}

.login-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray);
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-gray);
}

.login-form label i {
    margin-right: 0.5rem;
    color: var(--primary-blue);
}

.login-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--light-gray);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: var(--transition);
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.error-message {
    background: #fee2e2;
    color: var(--danger);
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: none;
}

.error-message.active {
    display: block;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--gray);
}

/* ===== Admin Dashboard ===== */
.admin-container {
    min-height: 100vh;
}

/* Mobile Header */
.mobile-header {
    display: none;
    background: var(--white);
    border-bottom: 1px solid var(--light-gray);
    padding: 0.75rem 1rem;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.mobile-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
    flex: 1;
}

.mobile-header-title i {
    color: var(--primary-blue);
    font-size: 1.5rem;
}

.mobile-header-spacer {
    width: 48px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    background: var(--gradient-primary);
    color: var(--white);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Sidebar */
.sidebar {
    background: var(--dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: bold;
}

.logo i {
    font-size: 1.75rem;
    color: var(--primary-blue);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: var(--white);
}

.nav-item i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
}

.content-header {
    background: var(--white);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.content-header h1 {
    font-size: 1.75rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--gray);
}

.user-info i {
    font-size: 2rem;
    color: var(--primary-blue);
}

.content-body {
    padding: 0;
}

/* Pages */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Page Content Padding */
#page-tournaments,
#page-sports,
#page-users,
#page-account {
    padding: 2rem;
}

/* Tournament detail page - no padding on main page, padding on sub-pages */
#page-tournament-detail {
    padding: 0;
}

#page-tournament-detail .sub-pages {
    padding: 2rem;
}

/* Page Actions */
.page-actions {
    margin-bottom: 1.5rem;
}

/* Items List */
.items-list, .tournament-list {
    display: grid;
    gap: 1rem;
}

.item-card, .tournament-item {
    background: var(--white);
    border-radius: 0.5rem;
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--light-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.item-card:hover, .tournament-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-blue);
    transform: translateY(-2px);
}

.item-info h3 {
    margin-bottom: 0.5rem;
}

.item-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--gray);
    font-size: 0.875rem;
}

.item-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark);
}

.btn-secondary:hover {
    background: var(--gray);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 1rem;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--light-gray);
    color: var(--dark);
}

.modal-content form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-gray);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-gray);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: 2px solid var(--light-gray);
    margin-top: 1.5rem;
}

.info-box {
    font-size: 0.9rem;
    line-height: 1.5;
}

.info-box p {
    word-wrap: break-word;
}

/* Form section headers */
.modal-content form h3 {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Section Card */
.section-card {
    background: var(--white);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--light-gray);
}

.section-card h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-gray);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-card + .section-card {
    margin-top: 2rem;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-gray);
    position: relative;
}

.section-header-row h2 {
    margin: 0;
    padding: 0;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

/* Pending User Card */
.pending-user-card {
    background: #fef3c7;
    border-left: 4px solid var(--warning);
}

/* User Role Badges */
.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-super_admin {
    background: #fee2e2;
    color: var(--danger);
}

.role-organizer {
    background: #dbeafe;
    color: var(--primary-blue);
}

.role-scorekeeper {
    background: #d1fae5;
    color: var(--success);
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pending {
    background: #fef3c7;
    color: var(--warning);
}

.status-approved {
    background: #d1fae5;
    color: var(--success);
}

.status-rejected {
    background: #fee2e2;
    color: var(--danger);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--white);
    border-bottom: 1px solid var(--light-gray);
    font-size: 0.875rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb-item:hover {
    color: var(--primary-blue);
}

.breadcrumb-item.active {
    color: var(--dark);
    font-weight: 600;
}

.breadcrumb-separator {
    color: var(--gray);
}

/* Sub Navigation */
.sub-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--white);
    border-bottom: 2px solid var(--light-gray);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sub-nav-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    color: var(--gray);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.sub-nav-item:hover {
    background: var(--light-gray);
    color: var(--dark);
}

.sub-nav-item.active {
    background: var(--gradient-primary);
    color: var(--white);
}

/* Tournament Detail Header */
.tournament-detail-header {
    background: var(--white);
    padding: 2rem;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid var(--light-gray);
}

.tournament-detail-header h1 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tournament-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    color: var(--gray);
}

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

/* Back Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light-gray);
    color: var(--dark);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1rem;
}

.btn-back:hover {
    background: var(--gray);
    color: var(--white);
}

/* Utilities */
.text-muted {
    color: var(--gray);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-upcoming {
    background: #dbeafe;
    color: var(--primary-blue);
}

.badge-active {
    background: #d1fae5;
    color: var(--success);
}

.badge-completed {
    background: #e5e7eb;
    color: var(--gray);
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.form-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h3 i {
    color: var(--primary-blue);
    font-size: 1.125rem;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background-color: #f3f4f6;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.checkbox-label span {
    user-select: none;
    font-weight: 500;
}

/* PWA Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Touch device optimizations */
    .btn, .nav-item, .sub-nav-item {
        min-height: 44px; /* iOS minimum touch target */
        min-width: 44px;
    }

    .btn-sm {
        min-height: 40px;
        padding: 0.625rem 1.125rem;
    }

    .item-actions {
        gap: 0.75rem;
    }
}

/* Prevent text selection on interactive elements */
.nav-item, .btn, .sub-nav-item, .breadcrumb-item {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling for PWA */
html {
    scroll-behavior: smooth;
}

/* Responsive */
@media (max-width: 768px) {
    /* Show mobile header */
    .mobile-header {
        display: flex;
    }

    /* Hide sidebar by default on mobile */
    .sidebar {
        width: 280px;
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        box-shadow: var(--shadow-lg);
        transition: left 0.3s ease;
        z-index: 1001;
    }

    /* Show sidebar when active */
    .sidebar.active {
        left: 0;
    }

    /* Overlay when menu is open */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: none;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .content-header {
        padding: 1rem 1.25rem;
    }

    /* Mobile padding for pages */
    #page-tournaments,
    #page-users,
    #page-account {
        padding: 1.25rem;
    }

    #page-tournament-detail .sub-pages {
        padding: 1.25rem;
    }

    /* Modal responsive styles */
    .modal {
        padding: 0.5rem;
    }

    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 0.75rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .modal-content form {
        padding: 1rem;
    }

    .modal-actions {
        padding: 1rem;
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.9375rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 1rem;
        padding: 0.625rem;
    }

    .form-group small {
        font-size: 0.8125rem;
    }

    .info-box {
        padding: 0.625rem !important;
        font-size: 0.8125rem !important;
    }

    .info-box p {
        font-size: 0.8125rem !important;
    }

    /* Form section headers in modals */
    .modal-content form h3 {
        font-size: 1rem;
        margin-top: 1rem;
        margin-bottom: 0.75rem;
        padding-top: 1rem;
    }

    .modal-content form h3:first-child {
        margin-top: 0;
        padding-top: 0;
    }

    .item-card, .tournament-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem;
    }

    .item-info {
        width: 100%;
    }

    .item-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .item-meta span {
        font-size: 0.8125rem;
    }

    .item-actions {
        width: 100%;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .item-actions .btn {
        flex: 1;
        min-width: 140px;
    }

    .breadcrumbs {
        padding: 0.75rem 1.25rem;
        font-size: 0.8125rem;
    }

    .sub-nav {
        flex-direction: column;
        padding: 0;
        gap: 0;
        overflow-x: visible;
        border-bottom: none;
    }

    .sub-nav-item {
        width: 100%;
        border-radius: 0;
        padding: 1rem 1.25rem;
        justify-content: flex-start;
        border-bottom: 1px solid var(--light-gray);
    }

    .sub-nav-item i {
        width: 24px;
        text-align: center;
    }

    .tournament-detail-header {
        padding: 1.25rem;
    }

    .tournament-detail-meta {
        flex-direction: column;
        gap: 0.75rem;
    }

    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-header-row h2 {
        width: 100%;
    }

    .section-card {
        padding: 1.25rem;
        border-radius: 0.375rem;
    }

    /* Tournament info table responsive */
    .section-card table {
        font-size: 0.9375rem;
    }

    .section-card table td {
        padding: 0.75rem 0 !important;
        display: block;
        width: 100%;
    }

    .section-card table tr {
        display: block;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .section-card table td:first-child {
        font-weight: 600;
        padding-bottom: 0.25rem !important;
    }

    /* Price tier cards responsive */
    #currentPriceInfo {
        padding: 0.875rem !important;
    }

    #currentPriceInfo > div[style*="display: flex"] {
        flex-direction: row !important;
        gap: 0.75rem !important;
    }

    #currentPriceInfo [style*="font-size: 1.5rem"] {
        font-size: 1.25rem !important;
    }

    #currentPriceInfo [style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }

    /* Item card price display */
    .item-card [style*="font-size: 1.25rem"] {
        font-size: 1.125rem !important;
    }
}

/* Extra small devices (phones < 480px) */
@media (max-width: 480px) {
    .modal {
        padding: 0.25rem;
    }

    .modal-content {
        border-radius: 0.5rem;
    }

    .modal-header,
    .modal-content form,
    .modal-actions {
        padding: 0.875rem;
    }

    .modal-header h2 {
        font-size: 1.125rem;
    }

    .form-group {
        margin-bottom: 0.875rem;
    }

    .form-group label {
        font-size: 0.875rem;
        margin-bottom: 0.375rem;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.5rem;
        font-size: 0.9375rem;
    }

    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }

    .btn-sm {
        padding: 0.5rem 0.875rem;
        font-size: 0.875rem;
    }

    .section-card {
        padding: 1rem;
    }

    .section-card h2 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }

    /* Section card header with button */
    .section-card > div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .section-card > div[style*="display: flex"] h2 {
        margin-bottom: 0 !important;
    }

    .section-card > div[style*="display: flex"] .btn-sm {
        width: 100%;
    }
}

/* ==========================================
   Validation Error Styles
   ========================================== */

/* Error state for input fields */
input.error,
select.error,
textarea.error {
    border-color: var(--danger, #dc2626) !important;
    background-color: #fee;
}

input.error:focus,
select.error:focus,
textarea.error:focus {
    border-color: var(--danger, #dc2626) !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Field error message */
.field-error {
    display: block;
    color: var(--danger, #dc2626);
    font-size: 0.875rem;
    margin-top: 0.375rem;
    font-weight: 500;
}

.field-error::before {
    content: '⚠ ';
    margin-right: 0.25rem;
}

/* Form group with error */
.form-group:has(.error) label {
    color: var(--danger, #dc2626);
}

/* ===== Group States & Matches System Styles ===== */

/* Badge additional colors for group states */
.badge-secondary {
    background-color: #e5e7eb;
    color: #6b7280;
}

.badge-success {
    background-color: #d1fae5;
    color: #059669;
}

.badge-info {
    background-color: #dbeafe;
    color: #2563eb;
}

.badge-warning {
    background-color: #fef3c7;
    color: #d97706;
}

.badge-danger {
    background-color: #fee2e2;
    color: #dc2626;
}

/* Teams Management Modal Styles */
.teams-management {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 1.5rem 0;
}

@media (max-width: 768px) {
    .teams-management {
        grid-template-columns: 1fr;
    }
}

.teams-add-section,
.teams-list-section {
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.teams-add-section h3,
.teams-list-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Team Item Styles */
.team-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.team-item:hover {
    border-color: var(--primary-blue);
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.1);
}

.team-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.team-seed {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary-blue);
    color: var(--white);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
}

.team-name {
    font-weight: 500;
    color: var(--dark);
}

/* Group Detail */
.group-detail-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.group-detail-header h2 {
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.group-detail-header .item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.group-detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.group-detail-info .detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.group-detail-info .detail-item .detail-label {
    font-size: 0.75rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.group-detail-info .detail-item .detail-value {
    font-weight: 600;
    color: var(--dark);
}

/* Standings Table */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.standings-table thead {
    background: #f9fafb;
}

.standings-table th {
    padding: 0.6rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    border-bottom: 2px solid #e5e7eb;
}

.standings-table th:nth-child(2) {
    text-align: left;
}

.standings-table td {
    padding: 0.6rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

.standings-table td:nth-child(2) {
    text-align: left;
    font-weight: 600;
}

.standings-table tbody tr:hover {
    background: #f9fafb;
}

.standings-table tbody tr:first-child td {
    background: rgba(254, 243, 199, 0.5);
}

.standings-table tbody tr:first-child:hover td {
    background: rgba(254, 243, 199, 0.7);
}

.standings-table .rank-cell {
    font-weight: 700;
    color: var(--gray);
}

.standings-table .points-cell {
    font-weight: 700;
    font-size: 1rem;
}

/* Cross Table */
.cross-table-wrapper {
    overflow-x: auto;
}

.cross-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.cross-table th,
.cross-table td {
    min-width: 55px;
    text-align: center;
    padding: 0.5rem 0.4rem;
    border: 1px solid #e5e7eb;
    font-size: 0.85rem;
}

.cross-table thead th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--gray);
    white-space: nowrap;
}

.cross-table tbody th {
    background: #f9fafb;
    font-weight: 600;
    text-align: left;
    font-size: 0.8rem;
    white-space: nowrap;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.cross-table td.cell-self {
    background: #1f2937;
}

.cross-table td.cell-match {
    cursor: pointer;
    transition: background 0.15s;
}

.cross-table td.cell-match:hover {
    background: #dbeafe;
}

.cross-table td.cell-live {
    background: #fef3c7;
}

.cross-table td.cell-finished {
    font-weight: 600;
}

.cross-table .match-link {
    color: var(--primary-blue);
    text-decoration: none;
}

/* Inline Team Management */
.team-management-inline {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.team-management-inline .add-team-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-management-inline .add-team-row {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.team-management-inline .add-team-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.team-management-inline .add-team-row .form-group.seed-group {
    flex: 0 0 80px;
}

@media (max-width: 768px) {
    .group-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .group-detail-info {
        grid-template-columns: 1fr 1fr;
    }
    .team-management-inline {
        grid-template-columns: 1fr;
    }
    .cross-table th,
    .cross-table td {
        min-width: 45px;
        padding: 0.3rem;
        font-size: 0.75rem;
    }
}

/* Schedule Filters */
.schedule-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.schedule-filters .filter-group {
    flex: 1;
    min-width: 150px;
}

.schedule-filters select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--white);
    color: var(--dark);
    cursor: pointer;
    transition: border-color 0.2s;
}

.schedule-filters select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

@media (max-width: 768px) {
    .schedule-filters {
        flex-direction: column;
    }
    .schedule-filters .filter-group {
        min-width: 100%;
    }
}

/* Matches Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table thead {
    background: #f9fafb;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid #e5e7eb;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    color: var(--gray);
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

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

.match-score {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--dark);
    font-family: 'Courier New', Courier, monospace;
}

/* Modal Large Size */
.modal-large {
    max-width: 900px;
}

/* Empty State for no teams/matches */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--gray);
}

.empty-state i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 1rem;
}

.empty-state p {
    font-size: 1rem;
    color: var(--gray);
}

/* Status Badge in Item Header */
.item-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.item-header h3 .badge {
    margin-left: 0;
}

/* Action Buttons Layout */
.item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.item-actions .btn {
    white-space: nowrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .item-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .match-score {
        font-size: 1rem;
    }
}

/* Section Header Row */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header-row h2 {
    margin: 0;
}

@media (max-width: 768px) {
    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* ===== Toast Notification Styles ===== */
.toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--white);
    color: var(--dark);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10001;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    min-width: 300px;
    max-width: 500px;
}

.toast-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-notification i {
    font-size: 1.5rem;
}

.toast-notification span {
    flex: 1;
    font-weight: 500;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-success i {
    color: var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-error i {
    color: var(danger);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-warning i {
    color: var(--warning);
}

.toast-info {
    border-left: 4px solid var(--primary-blue);
}

.toast-info i {
    color: var(--primary-blue);
}

@media (max-width: 768px) {
    .toast-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: unset;
        max-width: unset;
    }
}

/* ===== LIVE MATCH MANAGEMENT ===== */

.live-match-container {
    max-width: 1000px;
    margin: 0 auto;
}

.live-match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.live-match-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Scoreboard */
.live-match-scoreboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.live-match-team {
    flex: 1;
    text-align: center;
}

.live-match-team .team-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.live-match-team .team-fouls {
    font-size: 0.8rem;
    color: var(--gray);
}

.live-match-center {
    text-align: center;
    min-width: 200px;
}

.live-match-score {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.live-match-score .score-separator {
    margin: 0 0.5rem;
    color: var(--gray);
}

.live-match-timer-wrap {
    text-align: center;
}

.live-match-timer {
    font-size: 2.5rem;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--dark);
    letter-spacing: 2px;
}

.live-match-timer.timer-running {
    color: var(--success);
}

.live-match-timer.timer-ended {
    color: var(--danger);
    animation: timer-blink 1s ease-in-out infinite;
}

@keyframes timer-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.live-match-period {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Sticky scoreboard bar */
.live-match-sticky-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0.4rem 1rem;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.live-match-sticky-bar.visible {
    display: flex;
}

.live-match-sticky-bar .sticky-team {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--dark);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-match-sticky-bar .sticky-team-home {
    text-align: right;
}

.live-match-sticky-bar .sticky-team-away {
    text-align: left;
}

.live-match-sticky-bar .sticky-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.live-match-sticky-bar .sticky-score {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1;
}

.live-match-sticky-bar .sticky-score .score-separator {
    margin: 0 0.15rem;
    color: var(--gray);
}

.live-match-sticky-bar .sticky-timer {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--dark);
    min-width: 50px;
    text-align: center;
}

.live-match-sticky-bar .sticky-timer.timer-running {
    color: var(--success);
}

.live-match-sticky-bar .sticky-period {
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 600;
}

.live-match-sticky-bar .sticky-controls {
    display: flex;
    gap: 0.3rem;
    margin-left: 0.5rem;
}

.live-match-sticky-bar .sticky-controls .btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .live-match-sticky-bar {
        gap: 0.5rem;
        padding: 0.3rem 0.5rem;
    }

    .live-match-sticky-bar .sticky-team {
        font-size: 0.75rem;
        max-width: 70px;
    }

    .live-match-sticky-bar .sticky-score {
        font-size: 1.1rem;
    }

    .live-match-sticky-bar .sticky-timer {
        font-size: 0.85rem;
    }
}

/* Controls */
.live-match-controls {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Sections */
.live-match-section {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.live-match-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: 0.5rem;
}

/* Event Log */
.match-event-log {
    max-height: 400px;
    overflow-y: auto;
}

.match-event-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.match-event-item:last-child {
    border-bottom: none;
}

.event-time {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-blue);
    min-width: 55px;
}

.event-icon {
    min-width: 30px;
    text-align: center;
}

.event-desc {
    flex: 1;
    font-size: 0.9rem;
}

.event-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: 4px;
    color: var(--gray);
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--light-gray);
    color: var(--primary-blue);
}

.btn-icon-danger:hover {
    color: var(--danger);
}

/* Rosters */
.match-rosters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.roster-panel h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--primary-blue);
}

.roster-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--light-gray);
}

.roster-player:last-child {
    border-bottom: none;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-number {
    font-weight: 700;
    color: var(--primary-blue);
    min-width: 30px;
    text-align: center;
    font-size: 0.85rem;
}

.player-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.player-actions {
    display: flex;
    gap: 0.25rem;
}

.player-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.15s;
    color: white;
}

.player-action-btn:hover {
    transform: scale(1.15);
}

.player-action-btn.goal {
    background: #059669;
}

.player-action-btn.foul {
    background: #f59e0b;
}

.player-action-btn.yellow-card {
    background: #fef3c7;
    border: 1px solid #fbbf24;
}

.player-action-btn.red-card {
    background: #fecaca;
    border: 1px solid #dc2626;
}

.player-action-btn.penalty {
    background: var(--primary-blue);
    font-weight: 700;
    font-size: 0.8rem;
}

.card-icon {
    display: inline-block;
    width: 12px;
    height: 16px;
    border-radius: 2px;
}

.card-icon.yellow {
    background: #fbbf24;
}

.card-icon.red {
    background: #dc2626;
}

/* LIVE badge dot */
.badge-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #dc2626;
    border-radius: 50%;
    margin-right: 4px;
    animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Shootout panel */
.shootout-panel {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 2px solid var(--primary-blue);
}

.shootout-panel h3 {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.shootout-score {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.shootout-score .score-separator {
    margin: 0 1rem;
    color: var(--gray);
}

.shootout-action {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
}

.shootout-decided {
    padding-top: 1rem;
    border-top: 1px solid var(--light-gray);
}

/* Button sizes */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-info {
    background: #0ea5e9;
    color: white;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-info:hover {
    background: #0284c7;
}

.btn-outline {
    background: transparent;
    color: var(--primary-blue);
    border: 1px solid var(--primary-blue);
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--primary-blue);
    color: white;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Team quick actions (without player) */
.team-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.team-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    transition: all 0.15s;
}

.team-action-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-sm);
}

.team-action-btn.goal { background: #059669; }
.team-action-btn.foul { background: #f59e0b; }
.team-action-btn.yellow-card { background: #d97706; color: #1a1a1a; }
.team-action-btn.red-card { background: #dc2626; }
.team-action-btn.penalty { background: var(--primary-blue); }

/* Edit mode panel */
.edit-mode-panel {
    background: var(--white);
    border: 2px solid var(--primary-blue);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.edit-mode-header {
    background: var(--primary-blue);
    color: white;
    padding: 0.6rem 1.25rem;
}

.edit-mode-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
}

.edit-mode-body {
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-mode-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.edit-mode-row > label {
    min-width: 70px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark);
    white-space: nowrap;
}

.edit-mode-inputs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.edit-mode-inputs input[type="number"] {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.3rem;
    border-radius: 6px;
    border: 2px solid var(--light-gray);
}

.edit-mode-inputs input[type="number"]:focus {
    border-color: var(--primary-blue);
    outline: none;
}

.edit-mode-inputs select {
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    border: 2px solid var(--light-gray);
}

.edit-mode-inputs select:focus {
    border-color: var(--primary-blue);
    outline: none;
}

.edit-mode-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
}

.edit-mode-footer {
    padding: 0.5rem 1.25rem 0.75rem;
    text-align: right;
}

/* Btn outline secondary */
.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--gray);
    color: var(--gray);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline-secondary:hover {
    background: var(--gray);
    color: white;
}

/* Responsive - live match */
@media (max-width: 768px) {
    .live-match-scoreboard {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .live-match-score {
        font-size: 2.5rem;
    }

    .live-match-timer {
        font-size: 2rem;
    }

    .match-rosters {
        grid-template-columns: 1fr;
    }

    .live-match-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .player-action-btn {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
    }

    .team-quick-actions {
        justify-content: center;
    }

    .team-action-btn {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }

    .edit-mode-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .edit-mode-inputs {
        width: 100%;
    }
}

/* ===== Playoff Bracket Modal ===== */

.modal-body {
    padding: 1.5rem;
}

.modal-xl {
    max-width: 1100px;
}

.playoff-bracket-manager {
    width: 100%;
}

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

.playoff-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.playoff-header-actions {
    display: flex;
    gap: 0.5rem;
}

.playoff-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    color: #1e40af;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bracket-level {
    margin-bottom: 1.5rem;
}

.bracket-level-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--light-gray);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bracket-level-title i {
    color: var(--primary-blue);
    font-size: 0.875rem;
}

.bracket-matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.bracket-match-card {
    border: 1px solid var(--light-gray);
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--white);
    transition: var(--transition);
}

.bracket-match-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.bracket-match-card.third-place {
    border-color: var(--warning);
}

.bracket-match-name {
    background: var(--light-gray);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--dark-gray);
    border-bottom: 1px solid var(--light-gray);
}

.bracket-match-card.third-place .bracket-match-name {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.bracket-match-body {
    padding: 0.75rem;
}

.bracket-team-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.bracket-team-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bracket-team-select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1.5px solid var(--light-gray);
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--dark);
    background: var(--white);
    transition: var(--transition);
    cursor: pointer;
}

.bracket-team-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.15);
}

.bracket-vs {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray);
    padding: 0.25rem 0;
}

/* Responsive bracket */
@media (max-width: 768px) {
    .modal-xl {
        max-width: 100%;
    }

    .playoff-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .bracket-matches-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Quill Editor Overrides ===== */

.ql-toolbar.ql-snow {
    border-color: #d1d5db;
    border-radius: 0.5rem 0.5rem 0 0;
    background: #f9fafb;
}

.ql-container.ql-snow {
    border-color: #d1d5db;
    border-radius: 0 0 0.5rem 0.5rem;
    font-family: inherit;
}

#descriptionEditor .ql-editor {
    min-height: 150px;
    font-size: 0.95rem;
    line-height: 1.6;
}

#descriptionEditor .ql-editor.ql-blank::before {
    font-style: normal;
    color: #9ca3af;
}

.ql-snow .ql-attachment {
    width: 28px !important;
}

/* Attachment blocks in editor */
.attachment-block {
    margin: 0.75rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: default;
    user-select: none;
}

.attachment-block-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.attachment-block-inner:hover {
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.08);
}

.attachment-block-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
    width: 2rem;
    text-align: center;
    color: var(--primary-blue);
}

.attachment-block-icon.fa-file-pdf { color: #dc2626; }
.attachment-block-icon.fa-file-word { color: #2563eb; }
.attachment-block-icon.fa-file-excel { color: #16a34a; }
.attachment-block-icon.fa-file-powerpoint { color: #ea580c; }
.attachment-block-icon.fa-file-alt { color: #64748b; }

.attachment-block-info {
    flex: 1;
    min-width: 0;
}

.attachment-block-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1f2937;
    word-break: break-all;
    line-height: 1.3;
}

.attachment-block-size {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.15rem;
}

.attachment-block-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.attachment-block-inner:hover .attachment-block-actions {
    opacity: 1;
}

.attachment-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s, color 0.15s;
    text-decoration: none;
    color: #64748b;
    background: transparent;
}

.attachment-action-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.attachment-edit-btn:hover {
    background: #dbeafe;
    color: #1e40af;
}

.attachment-download-btn:hover {
    background: #dcfce7;
    color: #16a34a;
}

.attachment-remove-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ===== Tournament Stats ===== */
.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stats-metric-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 0.75rem;
    text-align: center;
}

.stats-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stats-metric-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.stats-metric-detail {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.stats-biggest-win {
    background: #fffbeb;
    border: 1px solid #fbbf24;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-biggest-win i { color: #f59e0b; }

.stats-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-section-card {
    background: var(--white);
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    overflow: hidden;
}

.stats-section-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.stats-section-header:hover {
    background: #f1f5f9;
}

.stats-section-header h3 {
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-section-header h3 i { color: var(--primary); }

.stats-section-header .toggle-icon {
    color: #94a3b8;
    transition: transform 0.2s;
}

.stats-section-body {
    padding: 0 1rem 1rem;
    border-top: 1px solid #e2e8f0;
}

.stats-section-body h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    margin: 1rem 0 0.5rem;
}

.stats-section-body h4 i {
    margin-right: 0.3rem;
    color: #64748b;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.stats-table th {
    background: #f8fafc;
    padding: 0.5rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #64748b;
    white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
}

.stats-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid #f1f5f9;
}

.stats-table tbody tr:hover {
    background: #f8fafc;
}

.stats-table .text-center { text-align: center; }
.stats-table .text-right { text-align: right; }
.stats-table .text-bold { font-weight: 700; }

.stats-table .rank-cell {
    width: 30px;
    text-align: center;
    color: #94a3b8;
    font-weight: 600;
}

.stats-table .player-number {
    display: inline-block;
    background: #e2e8f0;
    color: #475569;
    border-radius: 4px;
    padding: 0 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.3rem;
    min-width: 1.4rem;
    text-align: center;
}

.stats-table .goals-cell {
    font-weight: 700;
    color: var(--primary);
}

.stats-table .card-yellow {
    display: inline-block;
    width: 12px;
    height: 16px;
    background: #facc15;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 0.2rem;
}

.stats-table .card-red {
    display: inline-block;
    width: 12px;
    height: 16px;
    background: #ef4444;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 0.2rem;
}

.stats-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.stats-table th.sortable:hover {
    background: #e2e8f0;
}

.stats-table th.sorted-asc::after {
    content: ' ▲';
    font-size: 0.65rem;
}

.stats-table th.sorted-desc::after {
    content: ' ▼';
    font-size: 0.65rem;
}

.stats-empty {
    text-align: center;
    color: #94a3b8;
    padding: 1.5rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .stats-overview-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.5rem;
    }

    .stats-metric-value {
        font-size: 1.4rem;
    }

    .stats-table {
        font-size: 0.78rem;
    }

    .stats-table th, .stats-table td {
        padding: 0.35rem 0.4rem;
    }
}
