/* Inherit variables from style.css */

/* Main Layout */
.flex-container {
    display: flex;
    flex-direction: column; /* Force single column for history view */
    align-items: center;
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

/* Panel Containers */
.back-container1 {
    background-color: var(--white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.03);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 1200px;
    overflow-x: auto;
}

/* Header Tools */
.header-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h2 {
    font-family: 'Poppins', sans-serif;
    color: var(--primary-green);
    font-size: 1.5rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-row-count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: normal;
    background: #f0f0f0;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
}

/* Table Styles */
.table-widget {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

thead th {
    background-color: var(--primary-green);
    color: white;
    padding: 1rem;
    font-weight: 500;
    text-align: left;
    font-size: 0.95rem;
    white-space: nowrap;
}

thead th:first-child {
    border-top-left-radius: 8px;
}

thead th:last-child {
    border-top-right-radius: 8px;
}

tbody td {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

tbody tr:hover td {
    background-color: #f9fdf9;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status {
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.status--Nuevo {
    background-color: #e3f2fd;
    color: #1976d2;
}

.status--Visto {
    background-color: #fff3e0;
    color: #f57c00;
}

.status--Aceptado {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.status--Rechazado {
    background-color: #ffebee;
    color: #c62828;
}

/* Action Tags */
.tags {
    display: flex;
    gap: 0.5rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.2s;
    border: none;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

.tag--Detalles, .tag--details {
    background-color: var(--text-dark);
    color: white;
}

.tag--Detalles:hover, .tag--details:hover {
    background-color: black;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.tag--reject, .tag--Eliminar {
    background-color: #d32f2f;
    color: white;
}

.tag--reject:hover, .tag--Eliminar:hover {
    background-color: #c62828;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(211, 47, 47, 0.2);
}

.tag--cancel, .tag--Cancelar {
    background-color: #f57c00;
    color: white;
}

.tag--cancel:hover, .tag--Cancelar:hover {
    background-color: #ef6c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 124, 0, 0.2);
}

.action-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.btn-new {
    background: linear-gradient(135deg, var(--highlight-orange), var(--hover-orange));
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 102, 0, 0.3);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: flex-end;
    list-style: none;
    gap: 0.5rem;
    padding: 1rem 0 0 0;
    margin: 0;
}

.pagination li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-decoration: none;
    color: var(--text-dark);
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s;
}

.pagination li a:hover,
.pagination li a.active {
    background-color: var(--primary-green);
    color: white;
}

/* Responsive */
@media (max-width: 900px) {
    .table-row-count {
        display: none; 
    }
    
    table, thead, tbody, th, td, tr {
        display: block;
    }
    
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    tbody tr {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05); /* Card shadow */
        margin-bottom: 1.5rem;
        padding: 0;
        overflow: hidden;
        border: 1px solid #f0f0f0;
    }
    
    /* Card Header (First Cell: ID/Num) */
    tbody td:nth-of-type(1) {
        background: var(--primary-green);
        color: white;
        padding: 0.8rem 1rem;
        font-weight: 600;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: none;
    }
    
    tbody td:nth-of-type(1):before {
        content: "Registro #";
        font-weight: 400;
        opacity: 0.9;
    }

    /* Other cells */
    tbody td:not(:nth-of-type(1)) {
        padding: 0.8rem 1rem;
        border-bottom: 1px solid #f9f9f9;
        display: grid;
        grid-template-columns: auto 1fr; /* Allow label to take necessary space */
        align-items: center;
        text-align: left;
        gap: 1.5rem; /* More separation between label and val */
    }
    
    tbody td:not(:nth-of-type(1)):before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-dark); /* Darker label */
        text-align: left;
        min-width: 80px; /* Ensure alignment */
    }
    
    /* Specific labels with correct specificity */
    tbody td:nth-of-type(2):before { content: "Matrícula"; }
    tbody td:nth-of-type(3):before { content: "Faltó el"; }
    tbody td:nth-of-type(4):before { content: "Enviado"; }
    tbody td:nth-of-type(5):before { content: "Respuesta"; }
    tbody td:nth-of-type(6):before { content: "Estado"; }
    tbody td:nth-of-type(7):before { content: "Acciones"; }

    /* Actions Cell */
    tbody td:last-child {
        display: block; /* Stack buttons or flex them normally */
        text-align: center;
        padding: 1rem;
        background: #fdfdfd;
        border-top: 1px dashed #eee;
    }
    
    tbody td:last-child:before {
        display: none; /* Hide 'Acciones' text, it's obvious */
    }
    
    .tags {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
    }
    
    .tag {
        flex: 1; /* Make buttons expand on mobile for easier tapping */
        justify-content: center;
        min-width: 100px;
    }
    
    .btn-new {
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
    }
}
