/* Estilos personalizados */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    
    /* Variables del tema (se sobrescriben dinámicamente desde header.php) */
    --color-primario: #667eea;
    --color-secundario: #764ba2;
    --color-texto: #333333;
    --color-fondo: #ffffff;
    --fuente-principal: Arial, sans-serif;
    --fuente-titulos: Arial, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Cards con hover */
.card-hover {
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Estadísticas */
.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.info {
    border-left-color: var(--info-color);
}

/* Tablas */
.table-responsive {
    border-radius: 0.375rem;
}

/* Formularios */
.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Badges personalizados */
.badge-custom {
    padding: 0.5em 0.75em;
    font-size: 0.875em;
}

/* Loading spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Editor de contenido HTML */
.editor-container {
    min-height: 300px;
}

/* Lista de correos en flujo */
.correo-item {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.correo-item.completado {
    border-left-color: var(--success-color);
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }
    
    /* Navbar responsive */
    .navbar-brand img {
        max-width: 120px !important;
        height: auto !important;
    }
    
    /* Botones en móvil */
    .btn-group,
    .btn-group-vertical {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn,
    .btn-group-vertical .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    /* Cards responsive */
    .card-body {
        padding: 1rem;
    }
    
    /* Tablas responsive */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table-responsive th,
    .table-responsive td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Formularios responsive */
    .form-control,
    .form-select {
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    /* Modales responsive */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    /* Dropdowns responsive */
    .dropdown-menu {
        max-width: 100%;
        font-size: 0.9rem;
    }
    
    /* Listas responsive */
    .list-group-item {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    /* Badges responsive */
    .badge {
        font-size: 0.75rem;
        padding: 0.35em 0.65em;
    }
    
    /* Espaciado responsive */
    .mb-4,
    .mt-4 {
        margin-bottom: 1rem !important;
        margin-top: 1rem !important;
    }
    
    /* Contenedores responsive */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Headers responsive */
    h1, .h1 {
        font-size: 1.5rem;
    }
    
    h2, .h2 {
        font-size: 1.25rem;
    }
    
    h3, .h3 {
        font-size: 1.1rem;
    }
    
    /* Botones de acción en tablas */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Cards con múltiples columnas */
    .row > [class*="col-"] {
        margin-bottom: 1rem;
    }
    
    /* Input groups responsive */
    .input-group {
        flex-wrap: wrap;
    }
    
    .input-group > .form-control,
    .input-group > .form-select {
        flex: 1 1 auto;
        min-width: 0;
    }
}

@media (max-width: 576px) {
    /* Pantallas muy pequeñas */
    .container,
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    /* Ocultar columnas menos importantes en tablas */
    .table-responsive .d-none-mobile {
        display: none !important;
    }
    
    /* Botones full width en móvil */
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn:last-child {
        margin-bottom: 0;
    }
    
    /* Modales más pequeños */
    .modal-dialog {
        margin: 0.25rem;
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    /* Texto más pequeño */
    .text-muted {
        font-size: 0.8rem;
    }
    
    /* Iconos más pequeños */
    .fs-1 {
        font-size: 2rem !important;
    }
}

/* Prevenir solapamientos */
@media (max-width: 992px) {
    .row {
        margin-left: 0;
        margin-right: 0;
    }
    
    .row > [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Asegurar que los elementos no se salgan del contenedor */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* Prevenir overflow horizontal */
body {
    overflow-x: hidden;
}

.container,
.container-fluid {
    max-width: 100%;
}

/* Tablas con scroll horizontal suave */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Mejorar legibilidad en móvil */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    p, li, td, th {
        line-height: 1.6;
    }
}
