/**
 * TRV Puleva Cupones - Frontend Styles
 * Version: 2.0.1
 *
 * Mobile-first responsive design
 * Colores corporativos Puleva
 */

/* ==========================================================================
   Variables CSS
   ========================================================================== */
:root {
    --trv-primary: #003676;        /* Azul Puleva */
    --trv-success: #28a745;        /* Verde disponible */
    --trv-info: #17a2b8;           /* Azul descargado */
    --trv-danger: #dc3545;         /* Rojo expirado */
    --trv-warning: #ffc107;        /* Amarillo advertencia */
    --trv-gray-100: #f8f9fa;
    --trv-gray-200: #e9ecef;
    --trv-gray-300: #dee2e6;
    --trv-gray-400: #ced4da;
    --trv-gray-500: #adb5bd;
    --trv-gray-600: #6c757d;
    --trv-gray-700: #495057;
    --trv-gray-800: #343a40;
    --trv-gray-900: #212529;
    --trv-white: #ffffff;
    --trv-border-radius: 8px;
    --trv-transition: all 0.3s ease;
}

/* ==========================================================================
   Container Principal
   ========================================================================== */
.trv-cupones-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ==========================================================================
   Estadísticas
   ========================================================================== */
.trv-cupones-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.trv-stat {
    background: var(--trv-white);
    border: 2px solid var(--trv-gray-200);
    border-radius: var(--trv-border-radius);
    padding: 20px;
    text-align: center;
    transition: var(--trv-transition);
}

.trv-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.trv-stat__number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 5px;
    color: #4299E1;
}

.trv-stat__label {
    display: block;
    font-size: 0.875rem;
    color: var(--trv-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Colores específicos por tipo de stat */
.trv-stat--disponibles .trv-stat__number {
    color: #003676;
}

.trv-stat--descargados .trv-stat__number {
    color: #4A5565;
}

.trv-stat--expirados .trv-stat__number {
    color: var(--trv-danger);
}

/* ==========================================================================
   Botones
   ========================================================================== */
.trv-cupones-actions {
    text-align: center;
    margin-bottom: 40px;
}

.trv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--trv-border-radius);
    cursor: pointer;
    transition: var(--trv-transition);
    text-decoration: none;
}

.trv-btn--download {
    background: var(--trv-success);
    color: var(--trv-white);
    font-size: 1.125rem;
    padding: 18px 40px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.trv-btn--download:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

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

.trv-btn--download:disabled {
    background: var(--trv-gray-400);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.trv-btn--primary {
    background: var(--trv-primary);
    color: var(--trv-white) !important;
}

.trv-btn--primary:hover {
    background: #002555;
}

.btn-icon {
    font-size: 1.25rem;
}

.trv-help-text {
    margin-top: 10px;
    font-size: 0.875rem;
    color: var(--trv-gray-600);
}

/* ==========================================================================
   Mensajes
   ========================================================================== */


.trv-cupones-message {
    padding: 15px 20px;
    border-radius: var(--trv-border-radius);
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: space-between;
}
.trv-cupones-message p{
    margin-bottom: 0 !important;
}

.trv-cupones-message .icon {
    display: none;
}

.trv-cupones-message--success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;

}

.trv-cupones-message--error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.trv-cupones-message--info {
   display: block;
    color: #003676;
}
.trv-cupones-message--info p {
   margin-bottom: 25px !important;
   font-size: 20px;
}

/* ==========================================================================
   Lista de Cupones
   ========================================================================== */
.trv-cupones-list {
    margin-bottom: 40px;
}

.trv-cupones-section {
    margin-bottom: 40px;
}

.trv-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--trv-gray-200);
    font-size: 1.5rem;
    color: var(--trv-gray-800);
}

.trv-section-title .icon {
    font-size: 1.5rem;
}

.trv-section-title .badge {
    background: var(--trv-primary);
  color: var(--trv-white);
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 600;
  width: 40px;
  height: 40px;           
  aspect-ratio: 1 / 1;   
  display: flex;       
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Grid de cupones */
.trv-cupones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Tarjeta de cupón */
.trv-cupon {
    background: var(--trv-white);
    border: 2px solid var(--trv-gray-200);
    border-radius: var(--trv-border-radius);
    overflow: hidden;
    transition: var(--trv-transition);
    display: flex;
    flex-direction: column;
}

.trv-cupon:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* Estados del cupón */
.trv-cupon--disponible {
    border-color: var(--trv-success);
    border-width: 3px;
}

.trv-cupon--descargado {
    border-color: #4299E1;
    opacity: 0.8;
}

.trv-cupon--expirado {
    border-color: var(--trv-danger);
    opacity: 0.6;
    filter: grayscale(40%);
}

/* Imagen del cupón */
.trv-cupon__imagen {
    background: var(--trv-gray-100);
    padding: 20px;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trv-cupon__imagen img {
    max-width: 100%;
    height: auto;
    max-height: 120px;
    object-fit: contain;
}

.trv-cupon__imagen--placeholder {
    background: var(--trv-gray-200);
}

.trv-cupon__imagen--placeholder .icon {
    font-size: 4rem;
    opacity: 0.5;
}

/* Información del cupón */
.trv-cupon__info {
    padding: 20px;
    flex-grow: 1;
}

.trv-cupon__titulo {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--trv-gray-800);
    margin: 0 0 15px 0;
}

.trv-cupon__precio,
.trv-cupon__codigo {
    margin-bottom: 10px;
    font-size: 0.875rem;
}

.trv-cupon__precio .label,
.trv-cupon__codigo .label {
    color: var(--trv-gray-600);
    font-weight: 500;
}

.trv-cupon__precio .valor {
    color: #4299E1;
    font-size: 1.25rem;
    font-weight: 700;
    margin-left: 5px;
}

.trv-cupon__codigo .valor {
    background: var(--trv-gray-100);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--trv-primary);
    margin-left: 5px;
}

/* Fechas */
.trv-cupon__fechas {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--trv-gray-200);
}

.trv-cupon__fechas .fecha {
    font-size: 0.8125rem;
    margin-bottom: 5px;
    color: var(--trv-gray-600);
}

.trv-cupon__fechas .label {
    font-weight: 600;
    margin-right: 5px;
}

/* Estado del cupón */
.trv-cupon__estado {
    padding: 15px 20px;
    background: var(--trv-gray-100);
    text-align: end;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge--disponible {
    background: var(--trv-success);
    color: var(--trv-white);
}

.badge--descargado {
    background: #4299E1;
    color: var(--trv-white);
}

.badge--expirado {
    background: var(--trv-danger);
    color: var(--trv-white);
}
.trv-cupones-actions {
    max-width: 600px;
    margin: auto;
}

/* ==========================================================================
   Estados vacíos
   ========================================================================== */
.trv-cupones-empty {
    text-align: center;
    padding: 20px 20px;
    background: var(--trv-gray-100);
    border-radius: var(--trv-border-radius);
    margin-bottom: 20px;
}
.trv-cupones-actions {
    margin-bottom: 20px;
}
.trv-cupones-empty .empty-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.trv-cupones-empty h3 {
    font-size: 1.5rem;
    color: var(--trv-gray-700);
    margin-bottom: 10px;
}

.trv-cupones-empty p {
    color: var(--trv-gray-600);
    font-size: 1rem;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.trv-cupones-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--trv-white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--trv-white);
    font-size: 1.125rem;
    font-weight: 600;
}

/* ==========================================================================
   Login Required
   ========================================================================== */
.trv-cupones-login-required {
    text-align: center;
    padding: 40px 20px;
}

/* ==========================================================================
   Lista Dinámica de Hijos (formulario anónimo)
   ========================================================================== */

/* Header de sección con contador - Reutiliza estilos existentes */
.trv-form-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Contador de hijos - Extiende .badge existente */
.trv-children-counter {
    background: var(--trv-primary);
    color: var(--trv-white);
    padding: 8px 16px;
    border-radius: calc(var(--trv-border-radius) * 2.5);
    font-size: 0.875rem;
    font-weight: 600;
}

/* Lista de hijos */
.trv-children-list {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

/* Tarjeta individual de hijo - Reutiliza estilos de .trv-cupon */
.trv-child-card {
    background: var(--trv-white);
    border: 2px solid var(--trv-gray-200);
    border-radius: var(--trv-border-radius);
    overflow: hidden;
    transition: var(--trv-transition);
}

.trv-child-card:hover {
    border-color: var(--trv-primary);
    box-shadow: 0 4px 12px rgba(0, 54, 118, 0.1);
}

.trv-child-card-header {
    background: var(--trv-gray-200);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.trv-child-card-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--trv-primary);
}

/* Botón eliminar hijo - Extiende .trv-btn */
.trv-btn-remove-child {
    background: var(--trv-danger);
    color: var(--trv-white);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--trv-transition);
    font-size: 1.5rem;
    line-height: 1;
}

.trv-btn-remove-child:hover {
    background: #c82333;
    transform: scale(1.1);
}

.trv-child-card-body {
    padding: 20px;
}

/* Botón añadir hijo - Extiende .trv-btn base */
.trv-btn--add-child {
    width: 100%;
    background: var(--trv-gray-100);
    color: var(--trv-primary);
    border: 2px dashed var(--trv-primary);
    transition: var(--trv-transition);
}

.trv-btn--add-child:hover:not(:disabled) {
    background: var(--trv-primary);
    color: var(--trv-white);
    border-style: solid;
}
span.trv-form-help.remember-me-group {
    display: block;
    margin-top: 1rem;
    font-size: 16px;
}

.trv-btn--add-child:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--trv-gray-400);
    color: var(--trv-gray-500);
}
.elementor-kit-21 button.trv-btn-remove-child, .elementor-kit-21 button.trv-btn-remove-child:hover {
    background-color: transparent;
    border: transparent;
    width: 36px;
    height: 36px;
    color: var(--tr);
    font-size: 24px;
    line-height: 24px;
    padding: 0;
    text-align: right;
    transform: none;
}
#trv-btn-add-child {
    max-width: 350px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {

    .trv-stat__number {
        font-size: 2rem;
    }

    .trv-btn--download {
        width: 100%;
        padding: 15px 20px;
    }
    .trv-section-title{
        display: flex;
        justify-content: space-between;
        
    }
}
