/* ============================================
   MiFlecha - Competition Detail Styles
   Versión 2.0 - Limpio y Moderno
   ============================================ */

/* === HEADER === */
.comp-header {
    background: linear-gradient(135deg, #0054A5 0%, #0077CC 50%, #0054A5 100%);
    color: white;
    padding: 28px 24px;
    border-radius: 12px 12px 0 0;
    position: relative;
    overflow: hidden;
}
.comp-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}
.comp-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
}
.comp-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    position: relative;
    z-index: 2;
}
.comp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 14px;
    font-size: 0.9rem;
    opacity: 0.92;
    position: relative;
    z-index: 2;
}
.comp-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.comp-meta-item i { font-size: 1rem; opacity: 0.85; }

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-upcoming { background: #fd7e14; color: white; }
.badge-active { background: #28a745; color: white; }
.badge-past { background: #6c757d; color: white; }
.badge-live {
    background: #dc3545;
    color: white;
    animation: pulse-badge 1.8s infinite;
}
@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,53,69,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(220,53,69,0); }
}

/* Source badges */
.badge-source {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.badge-ianseo {
    background: rgba(255,255,255,0.18);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}
.badge-miflecha {
    background: rgba(40,167,69,0.2);
    color: #b8f0c8;
    border: 1px solid rgba(40,167,69,0.4);
}
.ianseo-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}
.ianseo-link:hover { color: white; text-decoration: underline; }

/* === BODY === */
.comp-body {
    background: white;
    border-radius: 0 0 12px 12px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* === TABS === */
.comp-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #eee;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #fafafa;
}
.comp-tabs::-webkit-scrollbar { display: none; }
.comp-tab {
    padding: 14px 20px;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    color: #666;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.comp-tab:hover { color: #0054A5; background: rgba(0,84,165,0.04); }
.comp-tab.active {
    color: #0054A5;
    border-bottom-color: #0054A5;
    font-weight: 600;
    background: white;
}
.comp-tab i { font-size: 0.85rem; }

/* === TAB CONTENT === */
.tab-panel { display: none; padding: 24px; }
.tab-panel.active { display: block; animation: fadeUp 0.25s ease; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === SECTION TITLES === */
.section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

/* === INFO GRID (Detalles) === */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.info-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.info-card i { font-size: 1.3rem; color: #0054A5; width: 24px; text-align: center; }
.info-card-text { font-size: 0.9rem; color: #333; }
.info-card-label { font-size: 0.75rem; color: #999; display: block; margin-bottom: 2px; }

/* === WEATHER === */
.weather-bar {
    background: linear-gradient(135deg, #e3f2fd, #f0f8ff);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    border: 1px solid #bbdefb;
}
.weather-bar-title { font-weight: 600; color: #0054A5; font-size: 0.85rem; }
.weather-stat { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #444; }
.weather-stat i { color: #0054A5; font-size: 0.9rem; }

/* === ACTIONS === */
.comp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.btn-primary { background: #0054A5; color: white; }
.btn-secondary { background: #f0f0f0; color: #333; }
.btn-danger { background: #dc3545; color: white; }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; }

/* === CATEGORIES GRID === */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.cat-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 14px;
    border-left: 3px solid #0054A5;
    transition: transform 0.2s;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 3px 10px rgba(0,0,0,0.06); }
.cat-card-name { font-weight: 600; color: #0054A5; margin-bottom: 4px; }
.cat-card-detail { font-size: 0.8rem; color: #888; }

/* === TABLES === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th {
    background: #f5f7f9;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}
.data-table tr:hover { background: #fafbfc; }
.data-table tr:last-child td { border-bottom: none; }

/* === RESULTS === */
.results-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.cat-filter {
    padding: 6px 14px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 0.8rem;
    text-decoration: none;
    color: #555;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.cat-filter:hover { background: #e3ecf5; color: #0054A5; }
.cat-filter.active { background: #0054A5; color: white; }

.result-block {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
}
.result-block-header {
    background: #0054A5;
    color: white;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
}
.result-block-header.ianseo-source {
    background: linear-gradient(135deg, #0054A5, #1a6bc4);
}
.result-block-header.miflecha-source {
    background: linear-gradient(135deg, #1a7f37, #28a745);
}
.result-count { font-size: 0.78rem; opacity: 0.85; font-weight: 400; }

/* Position badges */
.pos {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.78rem;
}
.pos-1 { background: #FFD700; color: #5a4800; }
.pos-2 { background: #C0C0C0; color: #444; }
.pos-3 { background: #CD7F32; color: #fff; }
.pos-other { background: #f0f0f0; color: #666; }

.score { font-weight: 700; color: #0054A5; }
.score-tens { color: #28a745; font-weight: 600; }
.score-x { color: #dc3545; font-weight: 600; }

/* PDF buttons */
.pdf-link {
    background: #e53e3e;
    color: white;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 0.7rem;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: background 0.2s;
}
.pdf-link:hover { background: #c53030; }

/* Export bar */
.export-bar {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 14px;
}

/* === NO RESULTS === */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; display: block; color: #ddd; }
.empty-state p { font-size: 0.95rem; margin: 0; }

/* === BRACKETS === */
.bracket-wrap {
    overflow-x: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}
.bracket-tools {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 10px;
}
.bracket-container {
    display: flex;
    padding: 12px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    min-width: max-content;
}
.round { display: flex; flex-direction: column; min-width: 220px; margin-right: 36px; }
.round-title {
    text-align: center;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 6px;
    margin-bottom: 12px;
    background: #0054A5;
    color: white;
    border-radius: 4px;
}
.match-container { margin-bottom: 24px; }
.match {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.match:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.match-header {
    display: flex;
    justify-content: space-between;
    background: #f5f5f5;
    padding: 4px 8px;
    font-size: 0.72rem;
    color: #888;
    border-bottom: 1px solid #eee;
}
.match-body { padding: 0; }
.athlete, .team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.82rem;
}
.athlete:last-child, .team:last-child { border-bottom: none; }
.athlete.winner, .team.winner { background: #e8f5e9; font-weight: 600; }
.athlete.loser, .team.loser { opacity: 0.6; }
.athlete-name, .team-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.athlete-score, .team-score { font-weight: 600; color: #333; font-size: 0.82rem; }
.match-status {
    text-align: center;
    font-size: 0.72rem;
    padding: 5px;
    background: #f1f8e9;
    color: #388e3c;
    border-top: 1px solid #c8e6c9;
}
.winner-badge { color: #4caf50; margin-right: 2px; }
.bye { color: #bbb; font-style: italic; }
.set-points {
    background: rgba(0,102,204,0.1);
    color: #0054A5;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    font-size: 0.8rem;
}
.shootoff-info {
    background: #fff3cd;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    color: #856404;
    margin-top: 3px;
    display: inline-block;
    border: 1px solid #ffeeba;
}
.bronze-container {
    border: 2px solid #cd7f32;
    border-radius: 8px;
    padding: 8px;
    margin-top: 20px;
    background: #fffaf5;
}
.bronze-title { text-align: center; font-weight: 600; color: #cd7f32; margin-bottom: 8px; font-size: 0.85rem; }
.match.with-connector::after {
    content: "";
    position: absolute;
    right: -36px;
    top: 50%;
    width: 36px;
    height: 2px;
    background: #ddd;
}

/* === SET DETAILS === */
.set-details {
    padding: 4px 8px 8px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    font-size: 0.75rem;
}
.set-details summary { cursor: pointer; color: #0054A5; font-weight: 600; padding: 4px 0; }
.set-comparison { width: 100%; border-collapse: collapse; margin-top: 4px; }
.set-comparison th, .set-comparison td { padding: 3px 5px; text-align: center; border-bottom: 1px solid #e9ecef; }
.set-comparison th { background: #f1f8ff; font-weight: 600; }
.set-win-cell { font-weight: 600; background: rgba(76,175,80,0.08); }
.set-totals { background: #f1f8ff; font-weight: 600; }

/* === SERIES === */
.series-info-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}
.phase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.phase-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    transition: transform 0.2s;
    text-decoration: none;
    color: inherit;
}
.phase-card:hover { transform: translateY(-2px); box-shadow: 0 3px 10px rgba(0,0,0,0.06); }
.phase-card.current { border: 2px solid #0054A5; background: #f0f6ff; }
.phase-num { font-weight: 600; color: #0054A5; font-size: 0.8rem; }
.phase-name { font-size: 0.9rem; color: #333; margin: 4px 0; }
.phase-date { font-size: 0.78rem; color: #999; }

.series-table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.series-table th { background: #f5f7f9; padding: 8px; text-align: center; font-weight: 600; border-bottom: 2px solid #ddd; }
.series-table td { padding: 8px; text-align: center; border-bottom: 1px solid #eee; }
.series-table th:nth-child(2), .series-table td:nth-child(2) { text-align: left; }
.series-table th:nth-child(3), .series-table td:nth-child(3) { text-align: left; }
.phase-score-val { font-weight: 600; color: #0054A5; }
.accum-cell { background: #f8f9fa; border-right: 2px solid #e0e0e0; }
.accum-val { font-weight: 600; color: #218838; }
.final-val { font-weight: 700; color: #d23f31; font-size: 1em; }
.series-legend { background: #f8f9fa; border-radius: 6px; padding: 10px 14px; margin-top: 12px; font-size: 0.8rem; color: #666; }
.series-legend p { margin: 3px 0; }
.series-legend i { color: #0054A5; margin-right: 4px; }

.series-cat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.series-cat-tab {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    text-decoration: none;
    color: #555;
    background: #f0f0f0;
    transition: all 0.2s;
}
.series-cat-tab:hover { background: #e3ecf5; color: #0054A5; }
.series-cat-tab.active { background: #0054A5; color: white; }

/* Category selector */
.cat-select-wrap {
    background: #f0f6ff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(0,84,165,0.15);
}
.cat-select-wrap label { display: block; font-weight: 600; color: #0054A5; font-size: 0.82rem; margin-bottom: 6px; }
.cat-select-wrap select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 100%;
    max-width: 280px;
    color: #333;
    background: white;
}
.cat-select-wrap select:focus { border-color: #0054A5; outline: none; box-shadow: 0 0 0 2px rgba(0,84,165,0.15); }

/* Team type tabs */
.team-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.team-tab-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    text-decoration: none;
    color: #555;
    background: #f0f0f0;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}
.team-tab-btn:hover { background: #e3ecf5; color: #0054A5; border-color: #0054A5; }
.team-tab-btn.active { background: #0054A5; color: white; border-color: #0054A5; }

.team-type-indicator {
    display: inline-block;
    padding: 1px 4px;
    margin-left: 4px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
}
.team-type-regular { background: #0054A5; color: white; }
.team-type-mixed { background: #7b2d8e; color: white; }

/* === MOBILE === */
@media (max-width: 768px) {
    .comp-header { padding: 20px 16px; }
    .comp-header h1 { font-size: 1.25rem; }
    .comp-meta { gap: 10px; }
    .tab-panel { padding: 16px; }
    .info-grid { grid-template-columns: 1fr; }
    .cat-grid { grid-template-columns: 1fr; }
    .phase-grid { grid-template-columns: 1fr; }
    .comp-tabs { gap: 0; }
    .comp-tab { padding: 10px 14px; font-size: 0.82rem; }

    .data-table thead { display: none; }
    .data-table tbody tr {
        display: block;
        border-bottom: 2px solid #eee;
        padding: 8px 0;
    }
    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 6px 12px;
        border: none;
    }
    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #888;
        font-size: 0.78rem;
    }

    .series-table { display: block; overflow-x: auto; }
    .export-bar { justify-content: center; }
    .weather-bar { gap: 12px; }
}

/* === PRINT === */
@media print {
    body * { visibility: hidden; }
    .container, .container * { visibility: visible; }
    .comp-tabs, .export-bar, .comp-actions, header, footer,
    .results-category-filters, .btn, .pdf-link, .cat-select-wrap,
    .banner-container { display: none !important; }
    .tab-panel:not(.active) { display: none !important; }
    .tab-panel.active { display: block !important; }
    .comp-header {
        background: none !important;
        color: #000 !important;
        padding: 0;
        border-radius: 0;
    }
    .comp-header::before { display: none; }
    .comp-header h1 { color: #000 !important; font-size: 18pt; }
    .badge { background: transparent !important; color: #333 !important; border: 1px solid #999; }
    .result-block { page-break-inside: avoid; margin-bottom: 20px; }
    .result-block-header { background: #eee !important; color: #333 !important; }
    .pos { border: 1px solid #999; }
    .pos-1 { background: #ffe082 !important; }
    .pos-2 { background: #e0e0e0 !important; }
    .pos-3 { background: #d7ccc8 !important; }
    .comp-body { box-shadow: none; }
}