/**
 * ARMember Facturas - Frontend Styles
 * Diseño estilo ClaseTube (Dark Theme)
 * 
 * @package ARMember_Facturas
 * @since 1.1.0
 */

/* ========================================
   VARIABLES Y RESET
   ======================================== */
.armf-historial-container {
    --armf-bg-dark: #1a1a1a;
    --armf-bg-card: #242424;
    --armf-bg-header: #2a2a2a;
    --armf-border: #333;
    --armf-primary: #FF003C;
    --armf-primary-hover: #cc0030;
    --armf-success: #00C853;
    --armf-danger: #FF003C;
    --armf-text: #ffffff;
    --armf-text-muted: #888;
    --armf-radius: 16px;
    --armf-radius-sm: 8px;
    --armf-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--armf-text);
}

/* ========================================
   TÍTULO PRINCIPAL
   ======================================== */
.armf-historial-titulo {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 30px 0;
    color: var(--armf-text);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--armf-primary);
    display: inline-block;
}

/* ========================================
   CONTENEDOR DE TABLA RESPONSIVE
   ======================================== */
.armf-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--armf-radius);
    background: var(--armf-bg-card);
    box-shadow: var(--armf-shadow);
    border: 1px solid var(--armf-border);
}

/* ========================================
   TABLA DE FACTURAS
   ======================================== */
.armf-facturas-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

/* Header de la tabla */
.armf-facturas-table thead {
    background: var(--armf-bg-header);
    border-bottom: 2px solid var(--armf-primary);
}

.armf-facturas-table thead th {
    padding: 18px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--armf-text-muted);
    border: none;
    white-space: nowrap;
}

/* Filas del body */
.armf-facturas-table tbody tr {
    border-bottom: 1px solid var(--armf-border);
    transition: all 0.2s ease;
}

.armf-facturas-table tbody tr:hover {
    background: rgba(255, 0, 60, 0.05);
}

.armf-facturas-table tbody tr:last-child {
    border-bottom: none;
}

.armf-facturas-table tbody td {
    padding: 20px 16px;
    font-size: 0.95rem;
    color: var(--armf-text);
    vertical-align: middle;
}

/* Número de factura */
.armf-facturas-table tbody td:first-child strong {
    color: var(--armf-text);
    font-size: 1rem;
    display: block;
    margin-bottom: 4px;
}

/* ID de transacción */
.armf-transaction-id {
    font-size: 0.7rem;
    color: var(--armf-text-muted);
    font-family: 'Consolas', 'Monaco', monospace;
    opacity: 0.7;
}

/* ========================================
   BADGES DE ESTADO
   ======================================== */
.armf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 80px;
}

.armf-badge-success {
    background: rgba(0, 200, 83, 0.15);
    color: var(--armf-success);
    border: 1px solid rgba(0, 200, 83, 0.3);
}

.armf-badge-danger {
    background: rgba(255, 0, 60, 0.15);
    color: var(--armf-danger);
    border: 1px solid rgba(255, 0, 60, 0.3);
}

/* ========================================
   BOTONES
   ======================================== */
.armf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--armf-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.armf-btn-download {
    background: var(--armf-primary);
    color: #fff !important;
    box-shadow: 0 4px 15px rgba(255, 0, 60, 0.3);
}

.armf-btn-download:hover {
    background: var(--armf-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 60, 0.4);
    color: #fff !important;
}

.armf-btn-download:active {
    transform: translateY(0);
}

.armf-btn-disabled {
    background: var(--armf-border);
    color: var(--armf-text-muted) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.armf-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ========================================
   ESTADO ANULADO
   ======================================== */
.armf-estado-anulado td {
    opacity: 0.5;
}

.armf-estado-anulado td:first-child strong {
    text-decoration: line-through;
    color: var(--armf-text-muted);
}

/* ========================================
   SIN FACTURAS
   ======================================== */
.armf-no-facturas {
    text-align: center;
    padding: 80px 30px;
    background: var(--armf-bg-card);
    border-radius: var(--armf-radius);
    border: 1px solid var(--armf-border);
}

.armf-no-facturas-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.armf-no-facturas p {
    color: var(--armf-text-muted);
    font-size: 1.1rem;
    margin: 0;
}

/* ========================================
   LOGIN REQUERIDO
   ======================================== */
.armf-login-required {
    text-align: center;
    padding: 80px 30px;
    background: var(--armf-bg-card);
    border-radius: var(--armf-radius);
    border: 1px solid var(--armf-border);
    box-shadow: var(--armf-shadow);
}

.armf-login-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.armf-login-required h3 {
    font-size: 1.5rem;
    margin: 0 0 10px 0;
    color: var(--armf-text);
}

.armf-login-required p {
    color: var(--armf-text-muted);
    margin: 0 0 30px 0;
    font-size: 1rem;
}

.armf-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 40px;
    background: var(--armf-primary);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: var(--armf-radius-sm);
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 0, 60, 0.3);
}

.armf-login-btn:hover {
    background: var(--armf-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 60, 0.4);
    color: #fff !important;
}

/* ========================================
   RESPONSIVE - TABLET
   ======================================== */
@media screen and (max-width: 992px) {
    .armf-facturas-table thead th,
    .armf-facturas-table tbody td {
        padding: 15px 12px;
    }
    
    .armf-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* ========================================
   RESPONSIVE - MÓVIL (Cards Layout)
   ======================================== */
@media screen and (max-width: 768px) {
    .armf-historial-titulo {
        font-size: 1.5rem;
        display: block;
        text-align: center;
    }
    
    .armf-table-responsive {
        background: transparent;
        border: none;
        box-shadow: none;
    }
    
    .armf-facturas-table {
        background: transparent;
    }
    
    .armf-facturas-table thead {
        display: none;
    }
    
    .armf-facturas-table tbody {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }
    
    .armf-facturas-table tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--armf-bg-card);
        border-radius: var(--armf-radius);
        border: 1px solid var(--armf-border);
        padding: 20px;
        box-shadow: var(--armf-shadow);
    }
    
    .armf-facturas-table tbody tr:hover {
        background: var(--armf-bg-card);
        border-color: var(--armf-primary);
    }
    
    .armf-facturas-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0;
        border-bottom: 1px solid var(--armf-border);
    }
    
    .armf-facturas-table tbody td:last-child {
        border-bottom: none;
        padding-top: 15px;
        justify-content: center;
    }
    
    .armf-facturas-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--armf-text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .armf-facturas-table tbody td:first-child {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 15px;
        border-bottom: 2px solid var(--armf-primary);
        margin-bottom: 5px;
    }
    
    .armf-facturas-table tbody td:first-child::before {
        display: none;
    }
    
    .armf-facturas-table tbody td:first-child strong {
        font-size: 1.1rem;
    }
    
    .armf-facturas-table tbody td:last-child::before {
        display: none;
    }
    
    .armf-btn-download {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.9rem;
    }
}

/* ========================================
   ANIMACIONES
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.armf-facturas-table tbody tr {
    animation: fadeIn 0.3s ease forwards;
}

.armf-facturas-table tbody tr:nth-child(1) { animation-delay: 0.05s; }
.armf-facturas-table tbody tr:nth-child(2) { animation-delay: 0.1s; }
.armf-facturas-table tbody tr:nth-child(3) { animation-delay: 0.15s; }
.armf-facturas-table tbody tr:nth-child(4) { animation-delay: 0.2s; }
.armf-facturas-table tbody tr:nth-child(5) { animation-delay: 0.25s; }

/* ========================================
   TEMA CLARO (Fallback)
   ======================================== */
@media (prefers-color-scheme: light) {
    body:not(.dark-theme) .armf-historial-container {
        /* Mantener tema oscuro por defecto para coincidir con ClaseTube */
        --armf-bg-dark: #1a1a1a;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .armf-btn-download {
        display: none !important;
    }
    
    .armf-facturas-table {
        border: 1px solid #000;
    }
    
    .armf-facturas-table thead {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .armf-facturas-table tbody tr {
        border-bottom: 1px solid #ccc;
    }
}
