/* ===== WESPA Shared Styles ===== */

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

body {
    font-family: 'Inter', sans-serif;
    background: #f4f7fc;
    color: #1e2a3e;
    line-height: 1.5;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* ===== Loader / Error ===== */

.loader {
    text-align: center;
    padding: 60px 20px;
    font-size: 1.2rem;
    color: #2c5f8a;
}

.error-box {
    background: #fee2e2;
    border-left: 6px solid #c00;
    padding: 20px;
    border-radius: 16px;
    margin: 30px 0;
}

/* ===== Cards / Panels ===== */

.card {
    background: white;
    border-radius: 28px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.03), 0 2px 6px rgba(0,0,0,0.05);
    padding: 24px 28px;
    margin-bottom: 28px;
}

/* ===== Buttons ===== */

.btn-primary {
    background: #1f6392;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: #154e73;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.expand-btn {
    background: #eef2ff;
    border: none;
    padding: 5px 12px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.1s;
    color: #1f6392;
}

.expand-btn:hover {
    background: #dfe6f5;
}

.expand-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Tabs ===== */

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    color: #5a6e8a;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
}

.tab-btn.active {
    color: #1f6392;
    border-bottom-color: #1f6392;
}

.tab-pane {
    display: none;
}

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

/* ===== Tables ===== */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

th {
    text-align: left;
    padding: 14px 12px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e0e9f0;
    background: #fafcff;
}

td {
    padding: 12px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: top;
}

tr:hover {
    background: #f8fafd;
}

/* ===== Badges ===== */

.badge-win {
    color: #2b7a3e;
    font-weight: 700;
}

.badge-loss {
    color: #bc4e2c;
}

.badge-draw {
    color: #e68a2e;
}

.rating-change-positive {
    color: #2b7a3e;
    font-weight: 600;
}

.rating-change-negative {
    color: #bc4e2c;
    font-weight: 600;
}

/* ===== Links ===== */

a {
    color: #1f6392;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ===== Footer ===== */

.footer-note {
    margin-top: 30px;
    text-align: center;
    font-size: 0.8rem;
    color: #6c86a3;
    border-top: 1px solid #e0e9f0;
    padding-top: 24px;
}

/* ===== Spinner ===== */

.spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Empty State ===== */

.empty-state {
    text-align: center;
    padding: 40px;
    color: #8ba0bc;
    background: white;
    border-radius: 20px;
}

/* ===== Responsive ===== */

@media (max-width: 700px) {
    .app-container { padding: 16px; }
}

/* ===== Query Page Specific ===== */

.query-header {
    text-align: center;
    padding: 40px 20px 20px;
}

.query-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1e4663;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}

.query-header p {
    color: #5b6e8c;
    font-size: 1rem;
}

.query-section {
    margin-bottom: 36px;
}

.query-section h2 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e4663;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.query-section h2 i {
    color: #1f6392;
}

/* ===== Autocomplete ===== */

.autocomplete-wrap {
    position: relative;
}

.autocomplete-wrap input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e9f0;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
    background: white;
}

.autocomplete-wrap input:focus {
    border-color: #1f6392;
}

.autocomplete-wrap input::placeholder {
    color: #a0b4cc;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e0e9f0;
    border-top: none;
    border-radius: 0 0 16px 16px;
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    display: none;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f0f4fa;
}

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

.autocomplete-item:hover {
    background: #f0f6ff;
}

.autocomplete-item .player-name {
    font-weight: 500;
    flex: 1;
}

.autocomplete-item .player-country {
    font-size: 0.8rem;
    color: #6c86a3;
}

.autocomplete-item .player-rating {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1f6392;
    min-width: 50px;
    text-align: right;
}

.autocomplete-item img.flag {
    width: 22px;
    height: auto;
    border-radius: 2px;
}

/* ===== Tournament Search Form ===== */

.search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.search-form .form-group {
    flex: 1;
    min-width: 180px;
}

.search-form label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5b6e8c;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.search-form input,
.search-form select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e9f0;
    border-radius: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
    background: white;
}

.search-form input:focus,
.search-form select:focus {
    border-color: #1f6392;
}

.search-form input::placeholder {
    color: #a0b4cc;
}

.search-form .form-actions {
    display: flex;
    gap: 10px;
    padding-bottom: 2px;
}

/* ===== Tournament Results ===== */

.tourney-result-card {
    background: white;
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: box-shadow 0.15s;
}

.tourney-result-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.tourney-result-card .tourney-info {
    flex: 2;
    min-width: 200px;
}

.tourney-result-card .tourney-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e4663;
    margin-bottom: 4px;
}

.tourney-result-card .tourney-name a {
    color: #1e4663;
}

.tourney-result-card .tourney-meta {
    font-size: 0.85rem;
    color: #6c86a3;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.tourney-result-card .tourney-meta i {
    margin-right: 4px;
    width: 14px;
}

.tourney-result-card .tourney-action {
    flex-shrink: 0;
}

.tourney-count {
    font-size: 0.9rem;
    color: #5b6e8c;
    margin-bottom: 16px;
}
