/* =============================================
   TeamCo Configurador de Presupuestos
   Estilos Frontend
   ============================================= */

:root {
    --tc-primary:    #1a3a5c;
    --tc-secondary:  #2e86c1;
    --tc-accent:     #e74c3c;
    --tc-success:    #27ae60;
    --tc-warning:    #f39c12;
    --tc-dark:       #2c3e50;
    --tc-light:      #ecf0f1;
    --tc-white:      #ffffff;
    --tc-border:     #d5d8dc;
    --tc-coste-bg:   #eaf4fb;
    --tc-coste-hd:   #2e86c1;
    --tc-club-bg:    #eafaf1;
    --tc-club-hd:    #27ae60;
    --tc-radius:     8px;
    --tc-shadow:     0 2px 12px rgba(0,0,0,0.10);
    --tc-font:       'Segoe UI', Arial, sans-serif;
}

/* CONTENEDOR PRINCIPAL */
#teamco-configurador {
    font-family: var(--tc-font);
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: var(--tc-white);
    border-radius: var(--tc-radius);
    box-shadow: var(--tc-shadow);
}

/* CABECERA */
.teamco-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--tc-primary);
    color: var(--tc-white);
    padding: 18px 24px;
    border-radius: var(--tc-radius) var(--tc-radius) 0 0;
    margin: -20px -20px 20px -20px;
}

.teamco-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: var(--tc-white);
}

.teamco-subtitle {
    font-size: 0.85rem;
    margin: 4px 0 0;
    opacity: 0.8;
    color: var(--tc-white);
}

.teamco-acciones-header {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* BOTONES */
.tc-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
}
.tc-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.tc-btn-primary  { background: var(--tc-secondary); color: #fff; }
.tc-btn-secondary{ background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.4); }
.tc-btn-danger   { background: var(--tc-accent); color: #fff; }
.tc-btn-dark     { background: var(--tc-dark); color: #fff; }
.tc-btn-add      { background: var(--tc-success); color: #fff; font-size: 0.9rem; padding: 10px 20px; }
.tc-btn-add-multi{ background: #1abc9c; color: #fff; font-size: 0.9rem; padding: 10px 20px; }

/* DATOS DEL PRESUPUESTO */
.teamco-datos-presupuesto {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid var(--tc-border);
    border-radius: var(--tc-radius);
    margin-bottom: 16px;
}

.tc-campo-grupo {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 200px;
}

.tc-campo-corto {
    max-width: 140px;
    min-width: 100px;
    flex: 0 0 auto;
}

.tc-campo-grupo label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--tc-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tc-campo-grupo input {
    padding: 8px 10px;
    border: 1px solid var(--tc-border);
    border-radius: 5px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    background: #fff;
}

.tc-campo-grupo input:focus {
    outline: none;
    border-color: var(--tc-secondary);
    box-shadow: 0 0 0 3px rgba(46,134,193,0.15);
}

/* LEYENDA */
.teamco-leyenda {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 0.82rem;
    font-weight: 600;
}

.tc-leyenda-item { display: flex; align-items: center; gap: 5px; }
.tc-color-coste  { color: var(--tc-coste-hd); }
.tc-color-club   { color: var(--tc-club-hd); }

/* TABLA */
.teamco-tabla-wrapper {
    overflow-x: auto;
    border-radius: var(--tc-radius);
    border: 1px solid var(--tc-border);
    margin-bottom: 16px;
}

.tc-tabla {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 1100px;
}

/* CABECERAS */
.tc-tabla thead tr:first-child th {
    background: var(--tc-primary);
    color: var(--tc-white);
    padding: 10px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.tc-th-grupo {
    text-align: center !important;
    font-size: 0.75rem !important;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.tc-grupo-coste { background: var(--tc-coste-hd) !important; }
.tc-grupo-club  { background: var(--tc-club-hd) !important; }

.tc-tabla thead tr:last-child th {
    padding: 8px 6px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    border-bottom: 2px solid var(--tc-border);
    line-height: 1.3;
}

.tc-tabla thead tr:last-child th.tc-grupo-coste {
    background: var(--tc-coste-bg);
    color: var(--tc-coste-hd);
    border-bottom: 2px solid var(--tc-coste-hd);
}

.tc-tabla thead tr:last-child th.tc-grupo-club {
    background: var(--tc-club-bg);
    color: var(--tc-club-hd);
    border-bottom: 2px solid var(--tc-club-hd);
}

/* FILAS CUERPO */
.tc-tabla tbody tr {
    border-bottom: 1px solid var(--tc-border);
    transition: background 0.15s;
}

.tc-tabla tbody tr:hover { background: #f0f7ff; }

.tc-tabla tbody td {
    padding: 6px 5px;
    vertical-align: middle;
    text-align: center;
}

.tc-tabla tbody td.tc-td-producto {
    text-align: left;
    padding-left: 10px;
}

/* Inputs dentro de la tabla */
.tc-tabla tbody td input[type="text"],
.tc-tabla tbody td input[type="number"] {
    width: 100%;
    padding: 5px 6px;
    border: 1px solid var(--tc-border);
    border-radius: 4px;
    font-size: 0.82rem;
    text-align: center;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.tc-tabla tbody td.tc-td-producto input[type="text"] {
    text-align: left;
    min-width: 160px;
}

.tc-tabla tbody td input:focus {
    outline: none;
    border-color: var(--tc-secondary);
    box-shadow: 0 0 0 2px rgba(46,134,193,0.15);
}

/* Celdas calculadas */
.tc-calc {
    font-weight: 600;
    background: #fafafa;
    color: var(--tc-dark);
    font-size: 0.83rem;
}

.tc-calc-coste { background: var(--tc-coste-bg); color: var(--tc-coste-hd); }
.tc-calc-club  { background: var(--tc-club-bg);  color: var(--tc-club-hd); }
.tc-calc-beneficio { background: #fef9e7; color: var(--tc-warning); font-weight: 700; }

/* Columnas de fondo por grupo */
.tc-tabla tbody td.tc-grupo-coste { background: rgba(234,244,251,0.4); }
.tc-tabla tbody td.tc-grupo-club  { background: rgba(234,250,241,0.4); }

/* Columna acciones */
.tc-col-acciones { width: 40px; }
.tc-btn-eliminar-fila {
    background: none;
    border: none;
    color: var(--tc-accent);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}
.tc-btn-eliminar-fila:hover { background: #fdecea; }

/* TFOOT */
.tc-tfoot-totales td {
    padding: 10px 6px;
    font-weight: 700;
    font-size: 0.88rem;
    border-top: 2px solid var(--tc-primary);
    background: var(--tc-light);
}

.tc-tfoot-label {
    text-align: right !important;
    padding-right: 12px !important;
    color: var(--tc-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tc-tfoot-valor { text-align: center; }
.tc-tfoot-totales td.tc-grupo-coste { background: var(--tc-coste-bg); color: var(--tc-coste-hd); }
.tc-tfoot-totales td.tc-grupo-club  { background: var(--tc-club-bg);  color: var(--tc-club-hd); }
.tc-tfoot-empty  { background: var(--tc-club-bg); }

/* BOTÓN AÑADIR */
.teamco-add-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* RESUMEN */
.teamco-resumen {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 20px;
}

.tc-resumen-card {
    flex: 1;
    min-width: 160px;
    padding: 16px 20px;
    border-radius: var(--tc-radius);
    text-align: center;
    box-shadow: var(--tc-shadow);
}

.tc-resumen-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.tc-resumen-valor {
    font-size: 1.5rem;
    font-weight: 700;
}

.tc-resumen-coste     { background: var(--tc-coste-bg); color: var(--tc-coste-hd); border: 2px solid var(--tc-coste-hd); }
.tc-resumen-club      { background: var(--tc-club-bg);  color: var(--tc-club-hd);  border: 2px solid var(--tc-club-hd); }
.tc-resumen-beneficio { background: #fef9e7; color: var(--tc-warning); border: 2px solid var(--tc-warning); }
.tc-resumen-margen    { background: #f4ecf7; color: #8e44ad; border: 2px solid #8e44ad; }

/* MODAL */
.tc-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tc-modal-content {
    background: #fff;
    border-radius: var(--tc-radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tc-modal-sm { max-width: 420px; }

.tc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--tc-primary);
    color: #fff;
}

.tc-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #fff;
}

.tc-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

.tc-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.tc-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--tc-border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Lista de presupuestos en modal */
.tc-lista-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--tc-border);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.tc-lista-item:hover { background: var(--tc-coste-bg); border-color: var(--tc-coste-hd); }

.tc-lista-nombre { font-weight: 600; font-size: 0.9rem; color: var(--tc-primary); }
.tc-lista-club   { font-size: 0.8rem; color: #666; }
.tc-lista-fecha  { font-size: 0.75rem; color: #999; }

/* NOTIFICACIÓN */
.tc-notificacion {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 22px;
    border-radius: var(--tc-radius);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 999999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: tcSlideIn 0.3s ease;
}

@keyframes tcSlideIn {
    from { transform: translateX(100px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

.tc-notif-success { background: var(--tc-success); color: #fff; }
.tc-notif-error   { background: var(--tc-accent);  color: #fff; }
.tc-notif-info    { background: var(--tc-secondary); color: #fff; }

/* LOADING */
.tc-loading {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

/* PRINT */
@media print {
    .teamco-acciones-header,
    .teamco-add-row,
    .tc-btn-eliminar-fila,
    .tc-modal,
    .tc-notificacion { display: none !important; }

    #teamco-configurador {
        box-shadow: none;
        padding: 0;
    }

    .teamco-header {
        background: var(--tc-primary) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .tc-tabla { font-size: 0.75rem; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .teamco-header { flex-direction: column; align-items: flex-start; }
    .teamco-resumen { flex-direction: column; }
    .tc-campo-corto { max-width: 100%; }
}
