* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px 10px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    max-width: 700px;
    margin: 0 auto 30px auto;
}

.header-main {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-main h1 {
    color: #333;
    font-size: 2em;
    margin-bottom: 5px;
}

.header-main p {
    color: #666;
    font-size: 1em;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 30px;
}

.card h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-block {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    margin-top: 10px;
}

.info-box {
    background: #d1fae5;
    border: 2px solid #10b981;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.info-box p {
    margin: 0;
    color: #065f46;
    font-size: 1.1em;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    color: white;
}

.stat-card h3 {
    font-size: 1em;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin: 0;
}

.stat-blue {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-yellow {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* Tabla */
.table-responsive {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead tr {
    background: #f3f4f6;
    border-bottom: 3px solid #667eea;
}

table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e5e7eb;
    color: #555;
}

table tbody tr:hover {
    background: #f9fafb;
}

.text-center {
    text-align: center;
}

.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.login-card p {
    color: #666;
    text-align: center;
    margin-bottom: 30px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

/* DataTable */
table.dataTable thead {
    background-color: #273c75;
    color: white;
}

table.dataTable tbody tr:hover {
    background-color: #f1f2f6;
}

.dataTables_wrapper {
    margin-top: 10px;
}

/* ============================================
   MENSAJES BÁSICOS (Compatibilidad)
   ============================================ */
.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin: 15px 0;
    font-size: 16px;
    animation: slideDown 0.4s ease-out;
}

.message.success {
    background-color: #48bb78;
    color: white;
    border-left: 5px solid #2f855a;
}

.message.error {
    background-color: #f56565;
    color: white;
    border-left: 5px solid #c53030;
}

.message.warning {
    background-color: #ed8936;
    color: white;
    border-left: 5px solid #c05621;
}

.message.info {
    background-color: #4299e1;
    color: white;
    border-left: 5px solid #2b6cb0;
}

/* Mensaje de éxito anterior (mantener para compatibilidad) */
.message-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 2px solid #10b981;
    border-left: 5px solid #059669;
    color: #065f46;
    padding: 15px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1em;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-success::before {
    content: "✓";
    display: inline-block;
    width: 30px;
    height: 30px;
    background: #4957ed;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    font-size: 1.2em;
}

.message-error {
    background: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

.message-warning {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    color: #92400e;
}

/* Animación básica */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MENSAJES DETALLADOS MEJORADOS
   ============================================ */

/* Contenedor del mensaje detallado */
.mensaje-detallado {
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    animation: slideIn 0.5s ease-out;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
}

/* Animación de entrada suave */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mensaje de éxito - Gradiente morado/azul */
.mensaje-detallado.success {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 3px solid #5a67d8;
}

/* Mensaje de error - Gradiente rosado/rojo */
.mensaje-detallado.error {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: 3px solid #e53e3e;
}

/* Título del mensaje */
.mensaje-detallado h3 {
    margin: 0 0 20px 0;
    font-size: 26px;
    font-weight: bold;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.4);
    text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

/* Contenedor de detalles con efecto glass */
.mensaje-detalles {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Párrafos de detalles */
.mensaje-detalles p {
    margin: 12px 0;
    font-size: 16px;
    line-height: 1.8;
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    transition: all 0.3s ease;
    border-left: 3px solid rgba(255, 255, 255, 0.5);
}

.mensaje-detalles p:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(8px);
    border-left-color: rgba(255, 255, 255, 0.8);
}

.mensaje-detalles strong {
    font-weight: 600;
    margin-right: 10px;
    min-width: 160px;
    display: inline-block;
}

/* Efecto especial para duración (último elemento) */
.mensaje-detallado.success .mensaje-detalles p:last-child {
    background: rgba(255, 215, 0, 0.35);
    border-left: 4px solid #ffd700;
    font-weight: 600;
    font-size: 17px;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

/* Animación de pulso suave */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.mensaje-detallado.success {
    animation: slideIn 0.5s ease-out, pulse 2s ease-in-out 0.5s;
}

/* Efecto de brillo al pasar mouse sobre el mensaje completo */
.mensaje-detallado::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.25), 
        transparent
    );
    transition: left 0.7s ease;
}

.mensaje-detallado:hover::before {
    left: 100%;
}

/* Icono en el título */
.mensaje-detallado h3::before {
    font-size: 32px;
    margin-right: 12px;
    display: inline-block;
    animation: iconBounce 0.6s ease-out 0.3s;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.mensaje-detallado.success h3::before {
    content: '✅';
}

.mensaje-detallado.error h3::before {
    content: '❌';
}

@keyframes iconBounce {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.2) rotate(-10deg);
    }
    75% {
        transform: scale(1.2) rotate(10deg);
    }
}

/* Loading spinner mejorado */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Responsive para mensajes detallados */
@media (max-width: 768px) {
    .mensaje-detallado {
        padding: 20px 15px;
    }
    
    .mensaje-detallado h3 {
        font-size: 22px;
    }
    
    .mensaje-detalles {
        padding: 15px;
    }
    
    .mensaje-detalles p {
        font-size: 14px;
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    
    .mensaje-detalles strong {
        min-width: auto;
        margin-bottom: 5px;
        display: block;
    }
}

/* Efecto de entrada escalonada para detalles */
.mensaje-detalles p {
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

.mensaje-detalles p:nth-child(1) { animation-delay: 0.1s; }
.mensaje-detalles p:nth-child(2) { animation-delay: 0.15s; }
.mensaje-detalles p:nth-child(3) { animation-delay: 0.2s; }
.mensaje-detalles p:nth-child(4) { animation-delay: 0.25s; }
.mensaje-detalles p:nth-child(5) { animation-delay: 0.3s; }
.mensaje-detalles p:nth-child(6) { animation-delay: 0.35s; }
.mensaje-detalles p:nth-child(7) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Brillo sutil en hover de cada detalle */
.mensaje-detalles p::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.3s ease;
}

.mensaje-detalles p {
    position: relative;
    overflow: hidden;
}

.mensaje-detalles p:hover::after {
    width: 100%;
    left: 0;
}

/* Responsive general */
@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 0.9em;
    }
    
    table th,
    table td {
        padding: 8px;
    }
}