/* =====================================================
   Estilos - Pirámides SeitiBot 2026
   ===================================================== */

:root {
    --primary: #1a237e;
    --primary-light: #3949ab;
    --secondary: #ff6f00;
    --success: #2e7d32;
    --warning: #f57f17;
    --danger: #c62828;
    --info: #0277bd;
    --dark: #212121;
    --light: #f5f5f5;
    --white: #ffffff;
    --gray: #9e9e9e;
    --border: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #3949ab 100%);
    min-height: 100vh;
    color: var(--dark);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 2rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.5rem;
    color: var(--primary);
}

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav a {
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    color: var(--dark);
    transition: all 0.3s;
    font-weight: 500;
}

.nav a:hover, .nav a.active {
    background: var(--primary);
    color: var(--white);
}

/* Alertas */
.alert {
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success { background: #e8f5e9; color: var(--success); border-left: 4px solid var(--success); }
.alert-error { background: #ffebee; color: var(--danger); border-left: 4px solid var(--danger); }
.alert-warning { background: #fff8e1; color: var(--warning); border-left: 4px solid var(--warning); }
.alert-info { background: #e1f5fe; color: var(--info); border-left: 4px solid var(--info); }

/* Main Content */
.main-content {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h2 {
    color: var(--primary);
    font-size: 1.4rem;
}

/* Grid de Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
}

.card-body {
    padding: 20px;
}

.card-body p {
    margin-bottom: 8px;
    color: #555;
}

.card-body p i {
    width: 20px;
    color: var(--primary);
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-configuracion { background: #fff3e0; color: var(--secondary); }
.badge-en_curso { background: #e3f2fd; color: var(--info); }
.badge-finalizado { background: #e8f5e9; color: var(--success); }
.badge-activo { background: #e8f5e9; color: var(--success); }
.badge-pendiente { background: #fff3e0; color: var(--secondary); }

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-light); }

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #388e3c; }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #f9a825; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #d32f2f; }

.btn-info { background: var(--info); color: var(--white); }
.btn-info:hover { background: #0288d1; }

.btn-secondary { background: var(--gray); color: var(--white); }
.btn-secondary:hover { background: #757575; }

/* Formularios */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Tabla */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th, table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
}

table tr:hover {
    background: #f5f5f5;
}

table img.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 15px;
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* Footer */
.footer {
    text-align: center;
    padding: 15px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

/* =====================================================
   PIRÁMIDE / BRACKET
   ===================================================== */
.piramide-container {
    padding: 20px;
    overflow-x: auto;
}

.piramide-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.piramide-info h2 {
    color: var(--primary);
}

.piramide-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    padding: 15px 25px;
    border-radius: var(--radius);
    text-align: center;
}

.stat-box .stat-number {
    font-size: 2rem;
    font-weight: 700;
}

.stat-box .stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Bracket visual */
.bracket {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 30px 0;
    min-width: fit-content;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.round-title {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.match-box {
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    min-width: 220px;
    position: relative;
    transition: all 0.3s;
}

.match-box:hover {
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.match-box.finalizado {
    border-color: var(--success);
}

.match-competitor {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.match-competitor:last-child {
    border-bottom: none;
}

.match-competitor.winner {
    background: #e8f5e9;
    font-weight: 700;
}

.match-competitor img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.match-competitor .comp-name {
    flex: 1;
    font-size: 0.85rem;
}

.match-competitor .comp-score {
    font-weight: 700;
    color: var(--primary);
    min-width: 25px;
    text-align: center;
}

.match-number {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary);
    color: var(--white);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

/* Podio */
.podio {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin: 40px 0;
    padding: 20px;
}

.podio-item {
    text-align: center;
    transition: transform 0.3s;
}

.podio-item:hover {
    transform: translateY(-5px);
}

.podio-item.primer-lugar .podio-base {
    height: 120px;
    background: linear-gradient(180deg, #ffd700, #ffb300);
}

.podio-item.segundo-lugar .podio-base {
    height: 90px;
    background: linear-gradient(180deg, #c0c0c0, #9e9e9e);
}

.podio-item.tercer-lugar .podio-base {
    height: 60px;
    background: linear-gradient(180deg, #cd7f32, #a0522d);
}

.podio-base {
    width: 120px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
}

.podio-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin-bottom: 10px;
}

.podio-nombre {
    font-weight: 600;
    margin-top: 8px;
    font-size: 0.9rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Competidores grid */
.competidores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.competidor-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
}

.competidor-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.competidor-card img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid var(--primary-light);
}

.competidor-card h4 {
    color: var(--dark);
    margin-bottom: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .nav {
        justify-content: center;
    }
    
    .section-header {
        flex-direction: column;
        text-align: center;
    }
    
    .grid-cards {
        grid-template-columns: 1fr;
    }
    
    .podio {
        flex-direction: column;
        align-items: center;
    }
    
    .bracket {
        flex-direction: column;
    }
}

/* Print styles para la pirámide */
@media print {
    .header, .nav, .footer, .btn {
        display: none !important;
    }
    
    .piramide-container {
        padding: 0;
    }
    
    body {
        background: white;
    }
}