/* Games Page - Uses standardized header from base.css */

.header-icon {
    color: var(--accent-gold);
}

.header-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-tournament {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-tournament:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-tournament i {
    font-size: 1.1rem;
}

/* Page Header - Middle Ground Styling */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
    padding: 1rem 0.75rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(59, 130, 246, 0.08));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(139, 92, 246, 0.15);
}

.page-header-content {
    flex: 1;
}

.page-header h1 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.75rem;
}

.page-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Game Actions Bar */
.game-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 300px;
    font-family: inherit;
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.game-count {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.game-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

thead {
    background-color: rgba(15, 23, 42, 0.8);
}

th {
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background: var(--bg-hover);
}

.sequence-cell {
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
}

.game-name {
    font-weight: 600;
    color: var(--primary);
}

/* Badge styles now centralized in base.css */

.points-cell {
    font-weight: 700;
    color: var(--accent-gold);
}

.actions-column {
    width: 250px;
}

.actions {
    white-space: nowrap;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-sm.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-sm.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-sm.btn-secondary {
    background: rgba(100, 116, 139, 0.3);
    color: var(--text-primary);
}

.btn-sm.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.5);
    transform: translateY(-1px);
}

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

.btn-sm.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Modal - TOP-DOWN style like teams */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    margin: 15% auto;
    padding: 1rem 0.75rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    border: 1px solid var(--border-light);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.warning {
    color: var(--accent-red);
    font-size: 0.875rem;
    font-weight: 500;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
}

.close {
    color: var(--text-muted);
    float: right;
    font-size: 1.75rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .admin-header,
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 0.75rem 0.5rem;
    }

    .game-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search input {
        width: 100%;
        max-width: none;
    }

    .actions-column {
        width: auto;
    }

    .btn-group {
        flex-direction: row;
        gap: 0.5rem;
    }

    .modal-content {
        margin: 20% auto;
        width: 95%;
        padding: 0.75rem 0.5rem;
    }

    th, td {
        padding: 0.5rem 0.35rem;
    }

    .preview-header {
        padding: 0.75rem 0.5rem;
    }

    .point-distribution-preview {
        padding: 0.75rem 0.5rem;
    }

    .point-cell {
        padding: 0.75rem 0.5rem;
    }

    .game-order-preview {
        padding: 0.75rem 0.5rem;
    }

    .point-preview-explanation {
        padding: 1rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .btn-sm {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }

    .admin-header,
    .page-header {
        padding: 0.5rem 0.35rem;
    }

    th, td {
        padding: 0.5rem 0.25rem;
        font-size: 0.875rem;
    }

    .modal-content {
        padding: 0.5rem 0.35rem;
    }

    .preview-header {
        padding: 0.5rem 0.35rem;
    }

    .point-distribution-preview {
        padding: 0.5rem 0.35rem;
    }

    .point-cell {
        padding: 0.5rem 0.35rem;
    }

    .game-order-preview {
        padding: 0.5rem 0.35rem;
    }

    .point-preview-explanation {
        padding: 0.75rem 0.35rem;
    }
}

/* Form Card Styling - CONSISTENT WIDTH */
.form-card {
    max-width: 800px;
    margin: 0 auto;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-light);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    font-size: 1.25rem;
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

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

/* Point Distribution Preview - CONSISTENT WIDTH */
.point-calculation-preview {
    margin: 2rem auto;
    padding: 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    max-width: 800px;
}

.preview-header {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.15));
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.preview-header h2 {
    color: var(--accent-gold);
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.preview-description {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.point-distribution-preview {
    padding: 1rem 0.75rem;
}

.point-table {
    max-width: 400px;
    margin: 0 auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.point-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.point-row:last-child {
    border-bottom: none;
}

.point-row:hover:not(.header) {
    background: rgba(251, 191, 36, 0.05);
}

.point-row.header {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(30, 41, 59, 0.9));
    font-weight: 700;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.85rem;
}

.point-row.highlight-1 {
    background: rgba(255, 215, 0, 0.15);
    font-weight: 600;
}

.point-row.highlight-2 {
    background: rgba(192, 192, 192, 0.15);
    font-weight: 600;
}

.point-row.highlight-3 {
    background: rgba(205, 127, 50, 0.15);
    font-weight: 600;
}

.point-cell {
    padding: 1rem;
    text-align: center;
    font-size: 1rem;
    color: var(--text-primary);
}

.point-cell:first-child {
    border-right: 1px solid var(--border-light);
    font-weight: 600;
}

@media (min-width: 640px) {
    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* Point Preview Explanation Section */
.point-preview-explanation {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.calculation-helper {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.calculation-helper strong {
    color: var(--accent-blue);
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.calculation-example {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-gold);
}

.calculation-example strong {
    color: var(--accent-gold);
    font-size: 1.15rem;
}

/* Update point table for 3 columns */
.point-row {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}

.place-cell {
    font-weight: 700;
    color: var(--text-primary);
}

.calculation-cell {
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.points-cell {
    font-weight: 700;
    color: var(--accent-gold);
    font-size: 1.05rem;
}

.point-cell:not(:last-child) {
    border-right: 1px solid var(--border-light);
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
    .calculation-helper {
        font-size: 0.9rem;
    }

    .calculation-example {
        font-size: 0.95rem;
    }

    .point-row {
        grid-template-columns: 0.8fr 1fr 0.8fr;
        font-size: 0.9rem;
    }

    .point-cell {
        padding: 0.75rem 0.5rem;
    }
}

/* Sequence Number Helper UI */
.sequence-input-wrapper {
    position: relative;
}

.sequence-helper {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.sequence-badge, .sequence-badge-edit {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.15));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius-sm);
    color: #4ade80;
    font-weight: 600;
    font-size: 0.9rem;
}

.sequence-badge-edit {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.15));
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.game-order-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.game-order-preview strong {
    display: block;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.game-order-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 200px;
    overflow-y: auto;
}

.game-order-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    background: rgba(100, 116, 139, 0.1);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.game-order-list li:hover {
    background: rgba(100, 116, 139, 0.2);
}

.game-seq {
    font-weight: 700;
    color: var(--accent-gold);
    min-width: 2rem;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
}

.game-name-preview {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.game-status-mini {
    font-size: 1rem;
    opacity: 0.7;
}

/* Scrollbar styling for game order list */
.game-order-list::-webkit-scrollbar {
    width: 6px;
}

.game-order-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.game-order-list::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.3);
    border-radius: 3px;
}

.game-order-list::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 191, 36, 0.5);
}

/* Game Mode Toggle Styles */
.game-mode-toggle {
    padding: 1rem;
    background: rgba(139, 92, 246, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.game-mode-toggle .checkbox-group {
    margin: 0;
}

.game-mode-toggle label {
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.game-mode-toggle input:checked + label {
    color: #8b5cf6;
}

/* Mobile Card Layout Styles */
.games-mobile-cards {
    display: none; /* Hidden on desktop */
}

.game-card-mobile {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.game-card-mobile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.game-card-header {
    padding: 1rem;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border-bottom: 1px solid var(--border-light);
}

.game-number {
    display: inline-block;
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}

.game-title {
    margin: 0.5rem 0;
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
}

.game-meta {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0;
    flex-wrap: wrap;
}

.game-points {
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 1rem;
    margin-top: 0.5rem;
}

.game-card-actions {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Mobile Buttons - Large and Prominent */
.btn-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    min-height: var(--touch-target-lg);
}

.btn-mobile i {
    font-size: 1.2rem;
}

/* Score Button - Use standardized btn-action-primary from base.css */
.btn-mobile-score {
    background: var(--gradient-green);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-mobile-score:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* View Button - Use standardized btn-action-view from base.css */
.btn-mobile-primary {
    background: var(--accent-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-mobile-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

/* Admin Actions - Smaller, Secondary Buttons */
.admin-actions-mobile {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.btn-mobile-small {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mobile-secondary {
    background: rgba(100, 116, 139, 0.3);
    color: var(--text-primary);
}

.btn-mobile-secondary:hover {
    background: rgba(100, 116, 139, 0.5);
}

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

.btn-mobile-danger:hover {
    background: #dc2626;
}

/* Responsive: Show cards on mobile, hide table */
@media (max-width: 768px) {
    .games-mobile-cards {
        display: block;
    }

    .game-table {
        display: none;
    }
}

/* Ensure table is shown on desktop */
@media (min-width: 769px) {
    .games-mobile-cards {
        display: none;
    }

    .game-table {
        display: block;
    }
}
