/* ========== Font ========== */
@font-face {
    font-family: 'Alibaba';
    src: url('/fonts/alibaba-regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Alibaba', sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    min-height: 100vh;
    line-height: 1.6;
}

/* ========== Header ========== */
.header {
    background: linear-gradient(135deg, #0d1b0d 0%, #0a0a0a 50%, #0d1b0d 100%);
    border-bottom: 3px solid #00e676;
    padding: 2rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 230, 118, 0.1);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

.accent {
    color: #00e676;
    text-shadow: 0 0 20px rgba(0, 230, 118, 0.3);
}

.subtitle {
    margin-top: 0.5rem;
    color: #888;
    font-size: 1rem;
}

/* ========== Container ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ========== Cards ========== */
.card {
    background: #111;
    border: 1px solid #1a1a1a;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color 0.3s;
}

.card:hover {
    border-color: #00e67640;
}

.card h2 {
    color: #00e676;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #1a2a1a;
}

/* ========== Search ========== */
.search-section h2 {
    margin-bottom: 1rem;
}

.search-row {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

#team-search {
    flex: 1;
    min-width: 250px;
    padding: 0.8rem 1rem;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 8px;
    color: #e0e0e0;
    font-family: 'Alibaba', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#team-search:focus {
    outline: none;
    border-color: #00e676;
    box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.1);
}

.btn-primary {
    padding: 0.8rem 2rem;
    background: #00e676;
    color: #000;
    border: none;
    border-radius: 8px;
    font-family: 'Alibaba', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #00c853;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ========== Team Results ========== */
.team-results {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.team-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: #0d1b0d;
    border: 1px solid #1a2a1a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.team-item:hover {
    border-color: #00e676;
    background: #0f220f;
}

.team-item .team-info {
    display: flex;
    flex-direction: column;
}

.team-item .team-name {
    font-weight: 600;
    color: #e0e0e0;
}

.team-item .team-comp {
    font-size: 0.85rem;
    color: #666;
}

.team-item .team-tla {
    font-size: 0.75rem;
    color: #00e676;
    background: #0a1a0a;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    border: 1px solid #1a2a1a;
}

/* ========== Config Section ========== */
.config-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.config-row label {
    color: #aaa;
    font-size: 0.95rem;
}

.config-row select {
    padding: 0.5rem 0.8rem;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 6px;
    color: #e0e0e0;
    font-family: 'Alibaba', sans-serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.3s;
}

.config-row select:focus {
    outline: none;
    border-color: #00e676;
}

/* ========== Loading ========== */
.loading {
    text-align: center;
    padding: 3rem;
}

.loading p {
    color: #888;
    margin-top: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #1a2a1a;
    border-top: 4px solid #00e676;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* ========== Error ========== */
.error-msg {
    background: #1a0a0a;
    border: 1px solid #c62828;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    color: #ef5350;
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ========== Summary Grid ========== */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    text-align: center;
    padding: 1.2rem 0.8rem;
}

.summary-icon {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #00e676;
}

.summary-label {
    font-size: 0.85rem;
    color: #888;
    margin-top: 0.3rem;
}

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

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

th {
    padding: 0.8rem;
    color: #00e676;
    font-weight: 600;
    border-bottom: 2px solid #1a2a1a;
    white-space: nowrap;
}

td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid #1a1a1a;
    color: #ccc;
}

tr:hover td {
    background: #0d1b0d;
}

.result-w {
    color: #00e676;
    font-weight: 700;
}

.result-d {
    color: #ffc107;
    font-weight: 700;
}

.result-l {
    color: #ef5350;
    font-weight: 700;
}

.ha-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.ha-home-badge {
    background: #0d220d;
    color: #00e676;
    border: 1px solid #1a3a1a;
}

.ha-away-badge {
    background: #220d0d;
    color: #ef5350;
    border: 1px solid #3a1a1a;
}

/* ========== Patterns ========== */
.patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.8rem;
}

.pattern-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.pattern-item:hover {
    border-color: #00e67640;
}

.pattern-label {
    font-size: 0.9rem;
    color: #ccc;
}

.pattern-bar-wrapper {
    flex: 1;
    margin: 0 1rem;
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    max-width: 120px;
}

.pattern-bar {
    height: 100%;
    background: linear-gradient(90deg, #00c853, #00e676);
    border-radius: 4px;
    transition: width 0.8s ease;
}

.pattern-count {
    font-weight: 700;
    color: #00e676;
    white-space: nowrap;
    font-size: 0.9rem;
}

/* ========== Home/Away ========== */
.ha-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .ha-grid {
        grid-template-columns: 1fr;
    }
}

.ha-card {
    padding: 1.2rem;
    border-radius: 8px;
}

.ha-home {
    background: #0d1b0d;
    border: 1px solid #1a3a1a;
}

.ha-away {
    background: #1b0d0d;
    border: 1px solid #3a1a1a;
}

.ha-card h3 {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.ha-home h3 { color: #00e676; }
.ha-away h3 { color: #ef5350; }

.ha-stats {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ha-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.9rem;
}

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

.ha-stat-label {
    color: #888;
}

.ha-stat-value {
    font-weight: 600;
    color: #e0e0e0;
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    padding: 1.5rem;
    color: #555;
    font-size: 0.85rem;
    border-top: 1px solid #1a1a1a;
    margin-top: 2rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    .header {
        padding: 1.5rem 1rem;
    }
    .config-row {
        flex-direction: column;
        align-items: stretch;
    }
    .config-row select {
        width: 100%;
    }
}
