:root {
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-700);
    --background-primary: var(--gray-100);
    --background-secondary: var(--gray-200);
    --border-color: var(--gray-300);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-primary);
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2 {
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--gray-700);
    color: var(--gray-100);
}

.btn-primary:hover {
    background-color: var(--gray-800);
}

.btn-secondary {
    background-color: var(--gray-300);
    color: var(--gray-800);
}

.btn-secondary:hover {
    background-color: var(--gray-400);
}

.card {
    background-color: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    padding: 0;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: white;
    table-layout: fixed;
}

th, td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

th {
    background-color: var(--background-secondary);
    color: var(--text-secondary);
    font-weight: 600;
}

/* Definir anchos de columnas */
table th:nth-child(1), 
table td:nth-child(1) { width: 20%; } /* Remitente */
table th:nth-child(2), 
table td:nth-child(2) { width: 50%; } /* Asunto */
table th:nth-child(3), 
table td:nth-child(3) { width: 20%; } /* Fecha */
table th:nth-child(4), 
table td:nth-child(4) { width: 12%; } /* Estado */
table th:nth-child(5), 
table td:nth-child(5) { width: 13%; } /* Acciones */

/* Reemplaza las secciones de media queries actuales con estas versiones actualizadas */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 0 10px;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.4rem 0.3rem;  /* Reducido el padding horizontal */
    }

    /* Ajuste de anchos para pantallas medianas */
    table th:nth-child(1), 
    table td:nth-child(1) { width: 15%; min-width: 70px; }  /* Remitente */
    table th:nth-child(2), 
    table td:nth-child(2) { width: 35%; min-width: 120px; } /* Asunto */
    table th:nth-child(3), 
    table td:nth-child(3) { width: 22%; min-width: 85px; }  /* Fecha */
    table th:nth-child(4), 
    table td:nth-child(4) { width: 13%; min-width: 60px; }  /* Estado */
    table th:nth-child(5), 
    table td:nth-child(5) { width: 15%; min-width: 50px; }  /* Acciones */

    td .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .btn-primary {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem;
        margin: 0;
        white-space: nowrap;
        width: auto !important;
        display: inline-block;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 0 8px;
    }

    table {
        font-size: 0.75rem;
    }

    th, td {
        padding: 0.35rem 0.25rem; /* Aún más reducido para móviles */
    }

    /* Ajuste de anchos para pantallas pequeñas */
    table th:nth-child(1), 
    table td:nth-child(1) { width: 18%; min-width: 60px; }  /* Remitente */
    table th:nth-child(2), 
    table td:nth-child(2) { width: 30%; min-width: 100px; } /* Asunto */
    table th:nth-child(3), 
    table td:nth-child(3) { width: 22%; min-width: 80px; }  /* Fecha */
    table th:nth-child(4), 
    table td:nth-child(4) { width: 15%; min-width: 55px; }  /* Estado */
    table th:nth-child(5), 
    table td:nth-child(5) { width: 15%; min-width: 45px; }  /* Acciones */

    .btn-primary {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem;
    }

    /* Asegurar que los botones en la tabla no se expandan al 100% */
    .table-responsive .btn {
        width: auto !important;
        display: inline-block !important;
        margin-bottom: 0 !important;
    }
}

/* Agregar estas reglas para mejorar el manejo del texto largo */
.table-responsive td {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mantener el botón siempre visible y compacto */
.col-acciones {
    text-align: center;
    white-space: nowrap;
}

/* Ajuste de tamaño para títulos */
.card h2 {
    font-size: 1.2rem; /* Tamaño reducido para "Correos para" */
}

.card h2 .email-address {
    font-size: 1rem; /* Tamaño aún más reducido para la dirección de correo */
    color: var(--text-secondary);
}