/* ============================================
   MODERN ASSIGNR STYLES - COMPREHENSIVE
   ============================================ */

/* CSS Variables for consistent theming */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --primary-light: #66BB6A;
    --secondary-color: #2196F3;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4CAF50;
    --info-color: #2196F3;

    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --text-light: #999;

    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;

    --border-color: #e0e0e0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.15);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1 {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    margin: 30px 0;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

h2 {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin: 25px 0 20px;
    color: var(--text-primary);
}

h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 15px 0;
    color: var(--text-primary);
}

h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 12px 0;
    color: var(--text-primary);
}

h5 {
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0;
    color: var(--text-secondary);
}

/* ============================================
   BUTTONS
   ============================================ */
button, .add-button, .assign-button {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.add-button {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.add-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.add-button:active {
    transform: translateY(0);
}

.button-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.assign-button {
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    font-size: 13px;
}

.assign-button:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

/* Table button fixes */
table button {
    pointer-events: auto !important;
    cursor: pointer !important;
    position: relative;
    z-index: 1;
}

table .assign-button,
table .edit-button,
table .delete-button {
    margin: 2px;
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: auto !important;
    cursor: pointer !important;
}

table .edit-button {
    background: var(--warning-color);
    color: white;
}

table .edit-button:hover {
    background: #f57c00;
}

table .delete-button {
    background: var(--danger-color);
    color: white;
}

table .delete-button:hover {
    background: #d32f2f;
}

.close-button, .close-edit-button {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover, .close-edit-button:hover {
    background: var(--danger-color);
    color: white;
    transform: rotate(90deg);
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

th {
    padding: 16px 12px;
    text-align: center;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
    border: none;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
}

td {
    padding: 14px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tbody tr {
    transition: var(--transition);
}

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

tbody tr.highlighted {
    background: #fff3cd !important;
    animation: highlight-pulse 1s ease-in-out;
}

@keyframes highlight-pulse {
    0%, 100% { background: #fff3cd; }
    50% { background: #ffe69c; }
}

/* ============================================
   FORMS & INPUTS
   ============================================ */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-light);
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* ============================================
   FILTER CONTAINER
   ============================================ */
.filter-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: nowrap;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.filter-container label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin: 0;
    white-space: nowrap;
}

.filter-container select,
.filter-container input {
    min-width: 150px;
    flex: 0 1 auto;
}

.filter-container input[type="text"] {
    min-width: 200px;
}

.filter-container button {
    background: var(--primary-color);
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-container button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content h2 {
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    font-size: 24px;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-content form input,
.modal-content form select,
.modal-content form textarea {
    margin: 0;
}

.modal-content form button[type="submit"] {
    margin-top: 8px;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.modal-content form button[type="submit"]:hover {
    background: var(--primary-dark);
}

/* Assignment Modal Specific Styles */
.modal-assign {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-assign.hidden {
    display: none;
}

.modal-assign-content {
    background: white;
    padding: 32px;
    border-radius: var(--border-radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

.referee-select-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    margin-bottom: 12px;
}

.referee-select {
    width: 100%;
}

.referee-info {
    background: white;
    padding: 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.view-matches-button {
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.view-matches-button:hover {
    background: #1976D2;
}

/* Stats Modal */
.stats-modal .modal-content {
    max-width: 1200px;
    width: 95%;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
    border-bottom: 2px solid var(--border-color);
    flex-wrap: wrap;
}

.tab-button {
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: var(--transition);
    font-weight: 500;
    font-size: 14px;
}

.tab-button:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* ============================================
   SELECT OPTIONS STYLING
   ============================================ */
option.available {
    color: var(--success-color);
    font-weight: 500;
}

option.unavailable {
    color: var(--text-light);
}

/* ============================================
   SORTING INDICATORS
   ============================================ */
th[data-sort-order="asc"]::after {
    content: " ▲";
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 4px;
}

th[data-sort-order="desc"]::after {
    content: " ▼";
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 4px;
}

/* ============================================
   AUTOPILOT CONFIG MODAL
   ============================================ */
.modal.ap-config {
    display: none;
}

.modal.ap-config:not(.hidden) {
    display: block;
}

.apc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.apc-card {
    width: min(980px, 95vw);
    max-height: 88vh;
    overflow: auto;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 24px;
}

.apc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.apc-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--text-primary);
}

.apc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.apc-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

@media (min-width: 860px) {
    .apc-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.apc-section {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    background: var(--bg-secondary);
}

.apc-section h4 {
    margin: 0 0 12px;
    font-size: 16px;
    letter-spacing: 0.2px;
    color: var(--text-primary);
}

.apc-row {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 12px;
}

.apc-row > label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

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

.apc-help {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.apc-field,
.apc-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    background: white;
    transition: var(--transition);
}

.apc-field:focus,
.apc-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.apc-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    font-size: 14px;
}

.apc-switch input {
    transform: translateY(1px);
}

.apc-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.apc-btn {
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.apc-btn:hover {
    background: var(--bg-secondary);
}

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

.apc-btn.primary:hover {
    background: var(--primary-dark);
}

.apc-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.apc-hr {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
    border: 0;
}

/* ============================================
   DIFFICULTY RULES CONFIG MODAL
   ============================================ */
.modal.dr-config {
    display: none;
}

.modal.dr-config:not(.hidden) {
    display: block;
}

.dr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.dr-card {
    width: min(1100px, 95vw);
    max-height: 88vh;
    overflow: auto;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 24px;
}

.dr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.dr-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--text-primary);
}

.dr-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dr-hr {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
    border: 0;
}

.dr-info-banner {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    color: #1565c0;
}

.dr-info-banner svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.dr-info-banner strong {
    color: #0d47a1;
}

.dr-info-banner span {
    font-size: 13px;
    color: #1976d2;
    line-height: 1.5;
}

.dr-rules-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 4px;
}

.dr-rule-card {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    background: var(--bg-secondary);
    transition: var(--transition);
}

.dr-rule-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.dr-rule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.dr-rule-name {
    flex: 1;
}

.dr-rule-name input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    font-weight: 600;
    background: white;
}

.dr-rule-actions {
    display: flex;
    gap: 8px;
}

.dr-rule-remove {
    padding: 6px 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.dr-rule-remove:hover {
    background: #d32f2f;
}

.dr-rule-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dr-conditions-section,
.dr-action-section {
    background: white;
    padding: 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.dr-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dr-condition-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
}

.dr-condition-item label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.dr-condition-item select,
.dr-condition-item input {
    width: 100%;
    padding: 8px;
    font-size: 13px;
}

.dr-condition-remove {
    align-self: flex-end;
    padding: 8px 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.dr-condition-remove:hover {
    background: #d32f2f;
}

.dr-add-condition {
    padding: 8px 16px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dr-add-condition:hover {
    background: #1976D2;
}

.dr-action-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.dr-action-inputs label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.dr-add-rule-section {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.dr-btn {
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 14px;
}

.dr-btn:hover {
    background: var(--bg-secondary);
}

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

.dr-btn.primary:hover {
    background: var(--primary-dark);
}

.dr-btn.add-rule {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    padding: 12px 24px;
    font-size: 15px;
}

.dr-btn.add-rule:hover {
    background: #1976D2;
}

.dr-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .dr-condition-item {
        grid-template-columns: 1fr;
    }

    .dr-action-inputs {
        grid-template-columns: 1fr;
    }

    .dr-footer {
        flex-direction: column;
    }

    .dr-footer .dr-btn {
        width: 100%;
    }
}

/* ============================================
   UI MODAL (Notification Modal)
   ============================================ */
#uiModal.hidden {
    display: none;
}

#uiModal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#uiModalOverlay {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 10, 10, 0.75);
    backdrop-filter: blur(4px);
}

#uiModalBox {
    position: relative;
    background-color: white;
    border-radius: var(--border-radius-lg);
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    animation: modalSlideIn 0.2s ease-out;
}

#uiModalIconContainer {
    margin: 0 auto 16px auto;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#uiModalIcon svg {
    width: 28px;
    height: 28px;
}

#uiModalTitle {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 10px 0;
}

#uiModalMessage {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 24px 0;
    word-wrap: break-word;
}

#uiModalCloseButton {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 15px;
}

#uiModalCloseButton:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#uiModalCloseButton:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
    .table-container {
        overflow-x: auto;
    }

    table {
        min-width: 1000px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    h1 {
        font-size: 26px;
    }

    h2 {
        font-size: 20px;
    }

    .button-container {
        flex-direction: column;
    }

    .add-button {
        width: 100%;
    }

    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-container select,
    .filter-container input {
        min-width: unset;
        width: 100%;
    }

    .modal-content {
        padding: 24px;
        width: 100%;
    }

    .tabs {
        gap: 4px;
    }

    .tab-button {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    h1 {
        font-size: 22px;
        margin: 20px 0;
    }

    .modal-content {
        padding: 20px;
    }

    th, td {
        padding: 10px 8px;
        font-size: 12px;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .button-container,
    .filter-container,
    .add-button,
    .close-button,
    button {
        display: none !important;
    }

    .modal {
        display: none !important;
    }

    table {
        page-break-inside: auto;
    }

    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* ============================================
   TEAM RANK DISPLAY & CLICKABLE INFO
   ============================================ */
.team-with-rank {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.team-rank {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* Standing info button */
.standing-info-btn {
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.7;
}

.standing-info-btn:hover {
    transform: scale(1.2);
    opacity: 1;
}

.standing-info-btn:active {
    transform: scale(0.95);
}

/* Mobile optimizations for standing info button */
@media (max-width: 768px) {
    .standing-info-btn {
        font-size: 16px !important;
        padding: 4px 6px !important;
        opacity: 1;
        /* Increase tap target size for mobile */
        min-width: 32px;
        min-height: 32px;
    }

    .team-rank {
        font-size: 10px;
        padding: 2px 4px;
    }
}

/* ============================================
   ACTION SIDEBAR (MODERN MENU)
   ============================================ */
.action-sidebar {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    width: 320px;
    background: white;
    border-radius: 16px 0 0 16px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 1500;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.action-sidebar:not(.hidden) {
    transform: translateY(-50%) translateX(0);
}

.action-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border-radius: 0 0 0 0;
}

.action-sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.close-sidebar-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.action-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.action-match-info {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
}

.action-match-info p {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

.action-match-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-action-btn {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    color: white;
}

.sidebar-action-btn svg {
    flex-shrink: 0;
}

.sidebar-action-btn.assign {
    background: linear-gradient(135deg, var(--secondary-color), #1976D2);
}

.sidebar-action-btn.assign:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.sidebar-action-btn.edit {
    background: linear-gradient(135deg, var(--warning-color), #f57c00);
}

.sidebar-action-btn.edit:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

.sidebar-action-btn.delete {
    background: linear-gradient(135deg, var(--danger-color), #d32f2f);
}

.sidebar-action-btn.delete:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-md);
}

/* Action menu trigger button in table */
.action-menu-trigger {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text-secondary);
    transition: var(--transition);
    border-radius: 4px;
}

.action-menu-trigger:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}