/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #fbfbfb;
    color: #003321;
    line-height: 1.47;
    font-size: 16px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navbar */
.navbar {
    background-color: #003321;
    color: white;
    padding: 1.25rem 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
    backdrop-filter: blur(10px);
    position: relative;
}

.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
    letter-spacing: -0.01em;
}

.nav-controls {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.season-selector {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid rgba(193,151,80,0.3);
    border-radius: 4px;
    background-color: rgba(193,151,80,0.15);
    color: white;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
}

.season-selector:hover {
    background-color: rgba(193,151,80,0.2);
    border-color: rgba(193,151,80,0.4);
}

.season-selector option {
    background-color: #003321 !important;
    color: white !important;
    padding: 0.5rem;
}

.season-selector option:hover,
.season-selector option:focus,
.season-selector option:checked {
    background-color: #003321 !important;
    color: white !important;
    opacity: 0.8;
}

/* Force dropdown styling on Windows */
.season-selector::-ms-expand {
    background-color: #003321;
    color: white;
}

/* Windows-specific overrides for select dropdown */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    .season-selector option {
        background-color: #003321 !important;
        color: white !important;
    }
}

/* Additional targeting for Windows browsers */
.season-selector {
    /* Force background color in dropdown */
    option {
        background-color: #003321 !important;
        color: white !important;
    }
}

/* Target select element on focus to override Windows styling */
.season-selector:focus option {
    background-color: #003321 !important;
    color: white !important;
}

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

/* Main Content */
.main-content {
    min-height: calc(100vh - 78px);
    padding: 0rem 0 3rem 0;
}

@media (max-width: 768px) {
    .main-content {
        padding-top: 0;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Screens */
.screen {
    animation: fadeIn 0.3s ease-in;
}

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

/* Login */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
    background: white;
    padding: 3rem;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
}

.login-container h2 {
    margin-bottom: 2rem;
    text-align: center;
    color: #003321;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #424245;
    font-size: 0.9375rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #d1d1d6;
    border-radius: 4px;
    font-size: 1rem;
    background-color: #fbfbfb;
    transition: all 0.2s ease;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #003321;
    box-shadow: 0 0 0 3px rgba(0,51,33,0.1);
    background-color: white;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    vertical-align: middle;
    -webkit-appearance: checkbox; /* Restore default checkbox appearance */
    appearance: checkbox;
}

.form-group label.checkbox-label {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: normal;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    position: relative;
    overflow: hidden;
    letter-spacing: -0.01em;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background-color: #003321;
    color: white;
    box-shadow: 0 2px 4px rgba(0,51,33,0.2);
}

.btn-primary:hover {
    background-color: #001a11;
    box-shadow: 0 4px 8px rgba(0,51,33,0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #c19750;
    color: #003321;
    box-shadow: 0 2px 4px rgba(193,151,80,0.2);
}

.btn-secondary:hover {
    background-color: #a17c3a;
    box-shadow: 0 4px 8px rgba(193,151,80,0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: #ff3b30;
    color: white;
    box-shadow: 0 2px 4px rgba(255,59,48,0.2);
}

.btn-danger:hover {
    background-color: #d70015;
    box-shadow: 0 4px 8px rgba(255,59,48,0.3);
    transform: translateY(-1px);
}

.btn-warning {
    background-color: #ff9500;
    color: white;
    box-shadow: 0 2px 4px rgba(255,149,0,0.2);
}

.btn-warning:hover {
    background-color: #cc7700;
    box-shadow: 0 4px 8px rgba(255,149,0,0.3);
    transform: translateY(-1px);
}

.btn-success {
    background-color: #34c759;
    color: white;
    box-shadow: 0 2px 4px rgba(52,199,89,0.2);
}

.btn-success:hover {
    background-color: #248a3d;
    box-shadow: 0 4px 8px rgba(52,199,89,0.3);
    transform: translateY(-1px);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.page-header h2 {
    color: #003321;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 6px;
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background-color: #003321;
    color: white;
    padding: 1.25rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(255,255,255,0.1);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f1f1;
    font-size: 0.9375rem;
    color: #1d1d1f;
}

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

.data-table .loading {
    text-align: center;
    color: #8e8e93;
    font-style: italic;
}

/* Info Box */
.info-box {
    background-color: rgba(193,151,80,0.08);
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,0.05);
    color: #424245;
}

/* Admin Sections */
.admin-sections {
    display: grid;
    gap: 2rem;
}

.admin-section {
    background: white;
    padding: 2.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.05);
}

.admin-section h3 {
    margin-bottom: 1.5rem;
    color: #003321;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.section-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.elo-form {
    margin-top: 1rem;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    margin: auto;
    padding: 2.5rem;
    border-radius: 6px;
    margin-top: 2em;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.05);
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
    color: #8e8e93;
    transition: color 0.2s ease;
}

.close:hover {
    color: #003321;
}

/* Error Messages */
.error-message {
    color: #ff3b30;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9375rem;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    background-color: white;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    margin: 0 auto;
    max-width: 1200px;
    border: 1px solid rgba(0,0,0,0.05);
}

.tab-btn {
    flex: 1;
    padding: 1.25rem 1.5rem;
    border: none;
    background-color: rgba(193,151,80,0.1);
    color: #8e8e93;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-right: 1px solid rgba(0,0,0,0.1);
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    background-color: #e5e5ea;
    color: #003321;
}

.tab-btn.active {
    background-color: white;
    color: #003321;
    font-weight: 600;
    box-shadow: inset 0 -2px 0 #003321;
}

.tab-btn.admin-only {
    display: none;
}

/* Tab Content */
.tab-content {
    max-width: 1200px;
    margin: 1.5rem auto 0;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select,
.filter-input {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(193,151,80,0.3);
    border-radius: 4px;
    font-size: 0.9rem;
}

.filter-input {
    width: 150px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: #faf8f5;
    border-radius: 4px;
}

.metric label {
    font-weight: 500;
    color: #555;
}

.metric span {
    font-weight: 600;
    color: #003321;
}

.metric .highlight {
    color: #003321;
    font-size: 1.1rem;
}

/* About Tab Styling */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.1rem 2rem 2rem 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
}

.about-content h1,
.about-content h2,
.about-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: #003321;
}

.about-content h1 { font-size: 2rem; }
.about-content h2 { font-size: 1.5rem; }
.about-content h3 { font-size: 1.25rem; }

.about-content p {
    margin-bottom: 1rem;
}

.about-content ul,
.about-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

.about-content blockquote {
    margin: 1rem 0;
    padding-left: 1rem;
    border-left: 4px solid #c19750;
    font-style: italic;
    color: #666;
}

.about-content code {
    background-color: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
}

.about-content pre {
    background-color: #f0f0f0;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
}

.about-content pre code {
    background-color: transparent;
    padding: 0;
}

.about-editor {
    max-width: 800px;
    margin: 0 auto;
}

.markdown-editor {
    width: 100%;
    min-height: 500px;
    padding: 1rem;
    font-family: monospace;
    font-size: 14px;
    border: 1px solid rgba(193,151,80,0.3);
    border-radius: 4px;
    resize: vertical;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Table Styling */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.5rem;
}

.sortable:hover {
    background-color: #003321;
}

.sortable.sorted::after {
    content: '';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
}

.sortable.sorted.asc::after {
    border-width: 0 5px 8px 5px;
    border-color: transparent transparent white transparent;
}

.sortable.sorted.desc::after {
    border-width: 8px 5px 0 5px;
    border-color: white transparent transparent transparent;
}

.data-table .positive {
    color: #34c759;
}

.data-table .negative {
    color: #ff3b30;
}

/* ELO Change Indicators */
.elo-gain {
    color: #27ae60;
    font-weight: 600;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.elo-loss {
    color: #e74c3c;
    font-weight: 600;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* Info Icon Tooltip */
.info-icon {
    display: inline-block;
    margin-left: 0.5rem;
    cursor: help;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    font-style: normal;
    font-size: 0.875rem;
}

.info-icon:hover {
    opacity: 1;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    border-radius: 4px;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

/* Game Types */
.tournament {
    background-color: #fff3cd;
}

.shootout {
    background-color: #d1ecf1;
}

.forfeit {
    background-color: #f8d7da;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .season-selector {
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-controls {
        flex-direction: column;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .tab-nav {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        flex: 1 1 33.333%;
        min-width: 120px;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select,
    .filter-input {
        width: 100%;
    }
    
    /* Improve table scrolling on mobile */
    .table-container {
        margin: 0 -1rem; /* Extend to screen edges */
        padding: 0 1rem; /* Add padding back for content */
        border-radius: 0; /* Remove border radius on mobile */
    }
    
    /* Add visual indicator for scrollable tables */
    .table-container::-webkit-scrollbar {
        height: 8px;
    }
    
    .table-container::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .table-container::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }
    
    /* Ensure minimum width for readability */
    .data-table {
        min-width: 600px; /* Prevents columns from getting too cramped */
    }
}
