@import 'variables.css';

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* =====================================================================
   HEADER & NAVBAR TIPO APP ANDROID
   ===================================================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    backdrop-filter: blur(8px);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
}

.header-brand img {
    height: 36px;
    width: auto;
    object-fit: contain;
}

.header-brand span {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.icon-btn {
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.25rem;
    transition: background-color 0.2s ease;
}

.icon-btn:hover {
    background-color: var(--bg-surface);
}

/* =====================================================================
   DRAWER / MENÚ SÁNDWICH LATERAL (60 FPS)
   ===================================================================== */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
}

.drawer-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    background-color: var(--bg-card);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.drawer-backdrop.active .app-drawer {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.drawer-link:hover, .drawer-link.active {
    background-color: var(--bg-surface);
    color: var(--primary);
}

/* =====================================================================
   BUSCADOR PREDICTIVO INSTANTÁNEO ("SMART SEARCH")
   ===================================================================== */
.search-bar-container {
    padding: 12px 16px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0 16px 0 42px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.search-result-card {
    transition: background 0.15s ease;
}

.search-result-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

.search-action-pill {
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.search-action-pill:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* =====================================================================
   CABECERA INSTITUCIONAL Y NAVEGACIÓN DEL CLUB (PUBLIC VIEW)
   ===================================================================== */
.public-page-wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

.club-banner-header {
    background: linear-gradient(135deg, var(--club-theme, #1a56db) 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 20px;
    color: #ffffff;
    margin-bottom: 16px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
}

.club-banner-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.club-banner-shield {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.club-banner-shield img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    padding: 3px;
}

.club-shield-fallback {
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.3rem;
    color: #ffffff;
}

.club-banner-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    font-family: var(--font-heading);
}

.club-banner-subtitle {
    font-size: 0.8rem;
    opacity: 0.85;
    color: #e2e8f0;
}

.club-nav-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.nav-pill {
    background: rgba(255,255,255,0.15);
    color: #ffffff !important;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none !important;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-block;
}

.nav-pill:hover {
    background: rgba(255,255,255,0.25);
    color: #ffffff !important;
}

.nav-pill.active {
    background: #ffffff;
    color: var(--club-theme, #1a56db) !important;
}

.standings-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.form-select-sm {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-share-wa {
    background: #059669;
    color: #ffffff !important;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none !important;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease;
}

.btn-share-wa:hover {
    background: #047857;
}

/* =====================================================================
   BANNER DUAL CONTEXTUAL (Plataforma vs Club)
   ===================================================================== */
.context-banner {
    position: relative;
    background: linear-gradient(135deg, var(--primary) 0%, #1e1b4b 100%);
    color: #ffffff;
    padding: 24px 16px;
    text-align: center;
    overflow: hidden;
}

.context-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

.banner-shield {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-full);
    background: #ffffff;
    padding: 6px;
    margin: 0 auto 10px;
    box-shadow: var(--shadow-md);
    object-fit: contain;
}

.banner-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.banner-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* =====================================================================
   PESTAÑAS DE NAVEGACIÓN DESLIZABLES (TABS APP)
   ===================================================================== */
.tabs-scroll-container {
    display: flex;
    overflow-x: auto;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 8px;
    scrollbar-width: none;
}

.tabs-scroll-container::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    white-space: nowrap;
    padding: 14px 18px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* =====================================================================
   TARJETAS DE PARTIDOS (MATCH CARDS)
   ===================================================================== */
.match-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

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

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.live-badge {
    background-color: var(--color-live);
    color: #ffffff;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.teams-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.team-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}

.team-shield {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.team-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.score-box {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    padding: 4px 12px;
    background-color: var(--bg-surface);
    border-radius: var(--radius-sm);
    min-width: 60px;
    text-align: center;
}

/* =====================================================================
   TABLA DE POSICIONES RESPONSIVE
   ===================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: center;
}

.standings-table th {
    background-color: var(--bg-surface);
    padding: 12px 8px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.standings-table td {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-color);
}

.standings-table tr:hover td {
    background-color: var(--bg-surface);
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    font-weight: 600;
}

.form-badge {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    margin: 0 1px;
}

.form-w { background-color: var(--color-win); }
.form-d { background-color: var(--color-draw); }
.form-l { background-color: var(--color-loss); }

/* =====================================================================
   BOTÓN FLOTANTE WHATSAPP & ACCIONES RÁPIDAS
   ===================================================================== */
.whatsapp-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background-color: #25d366;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: var(--shadow-lg);
    text-decoration: none;
    z-index: 500;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.whatsapp-fab:hover {
    transform: scale(1.1);
}
