/* ========================================
   SISTEMA DE NOTIFICACIONES WEB
   Estilos principales del panel de usuario
   ======================================== */

/* Variables CSS */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    
    --bg-color: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --border-radius: 0.5rem;
    --border-radius-lg: 0.75rem;
    
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Reset y base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    max-width: 1600px;
    margin: 0 auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
}

.logo h1 {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.nav a:hover,
.nav a.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
}

/* Estilo específico para el enlace de Cerrar Sesión */
.nav a[href="logout.php"]:hover {
    color: #ea4335; /* Rojo Google */
    background-color: rgba(234, 67, 53, 0.1); /* Fondo rojo transparente */
    transition: all 0.3s ease;
}

.nav i {
    margin-right: 0.5rem;
}

.user-info {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Alertas */
.alert {
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.alert-success {
    background-color: #ecfdf5;
    color: var(--success-color);
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fef2f2;
    color: var(--danger-color);
    border: 1px solid #fecaca;
}

.alert-warning {
    background-color: #fffbeb;
    color: var(--warning-color);
    border: 1px solid #fed7aa;
}

.alert-info {
    background-color: #eff6ff;
    color: var(--info-color);
    border: 1px solid #bfdbfe;
}

/* Main content */
.main {
    padding: 2rem 0;
}

.main section {
    margin-bottom: 3rem;
}

.main h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main h2 i {
    color: var(--primary-color);
}

/* Dashboard - Estadísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 1.05rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 1.05rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.05rem;
}

.stat-content h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Formulario de nueva notificación */
.nueva-notificacion {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

/* Clase genérica para tarjetas de contenido */
.content-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #34a853, #0f9d58);
    color: white;
    border: none;
    font-weight: 600;
    letter-spacing: 0.025em;
    box-shadow: 0 4px 14px 0 rgba(52, 168, 83, 0.25);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2d8f47, #0d8a4f);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 168, 83, 0.4);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 14px rgba(52, 168, 83, 0.3);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: white;
}

.btn-outline-success {
    background: transparent;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.btn-outline-success:hover {
    background: var(--success-color);
    color: white;
}

.btn-outline-warning {
    background: transparent;
    color: var(--warning-color);
    border: 1px solid var(--warning-color);
}

.btn-outline-warning:hover {
    background: var(--warning-color);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Historial de notificaciones */
.historial {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 3rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Tabla */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.table tr:hover {
    background-color: #f8fafc;
}

/* Estados */
.status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-enviado {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-entregado {
    background-color: #dcfce7;
    color: #166534;
}

.status-abierto {
    background-color: #fef3c7;
    color: #92400e;
}

.status-descargado {
    background-color: #f3e8ff;
    color: #7c3aed;
}

.status-certificado {
    background-color: #f5f5f5; /* Gris claro */
    color: #000000; /* Negro */
}

/* Certificaciones */
.certificaciones {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Acciones */
.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 4rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .table-container {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .certificaciones,
    .actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .main {
        padding: 1rem 0;
    }
    
    .nueva-notificacion,
    .historial {
        padding: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .stat-content h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 1000px) {
    .historial, .table-container, .table {
        max-width: 100%;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main section {
    animation: fadeIn 0.5s ease-out;
}

/* Estados de carga */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mejoras de accesibilidad */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible para navegación por teclado */
.btn:focus-visible,
.form-group input:focus-visible,
.form-group textarea:focus-visible,
.form-group select:focus-visible {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

/* Nuevos estilos para los iconos de certificación */
.cert-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.4rem; /* Tamaño base de iconos (aprox 40% más grande) */
    transition: color 0.2s ease, transform 0.2s ease;
    padding: 0.25rem;
}

.btn-icon:hover {
    transform: scale(1.1);
}

.btn-icon i.cert-manual { color: var(--primary-color); }
.btn-icon:hover i.cert-manual { color: var(--primary-dark); }

.btn-icon i.cert-auto { color: var(--info-color); }
.btn-icon:hover i.cert-auto { color: #06728a; } /* Un poco más oscuro */

.btn-icon i.cert-posterior { color: var(--primary-color); }
.btn-icon:hover i.cert-posterior { color: var(--primary-dark); } /* Un poco más oscuro */

.btn-icon.disabled {
    color: #cbd5e1; /* gris claro */
    cursor: not-allowed;
    transform: none;
}

.btn-icon.disabled i {
    color: inherit !important; /* Forzar el color gris */
}

.actions .btn-icon {
    color: var(--secondary-color);
}

/* Estilos específicos para el icono de Ver Detalles */
.actions .btn-icon.ver-detalles {
    color: #059669;
    font-size: 1.5em; /* 50% más grande (1em * 1.5 = 1.5em) */
    transition: all 0.2s ease;
}

.actions .btn-icon.ver-detalles:hover {
    color: #047857; /* Un poco más oscuro al hacer hover */
    transform: scale(1.1);
}

/* Estilo específico para el icono de PDF */
.actions .btn-icon i.fa-file-pdf {
    color: #ea4335; /* Rojo Google */
}

.actions .btn-icon:hover i.fa-file-pdf {
    color: #d32f2f; /* Rojo Google más oscuro en hover */
}

/* ========================================
   PAGINACIÓN
   ======================================== */

.pagination-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pagination-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

.pagination-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Responsive para paginación */
@media (max-width: 768px) {
    .pagination-container {
        padding: 0.75rem;
    }
    
    .pagination {
        gap: 0.125rem;
    }
    
    .pagination-btn {
        min-width: 2.25rem;
        height: 2.25rem;
        padding: 0 0.5rem;
        font-size: 0.8rem;
    }
    
    .pagination-info {
        font-size: 0.8rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .pagination {
        gap: 0.125rem;
    }
    
    .pagination-btn {
        min-width: 2rem;
        height: 2rem;
        padding: 0 0.375rem;
        font-size: 0.75rem;
    }
    
    .pagination-ellipsis {
        min-width: 2rem;
        height: 2rem;
    }
}

.sidebar, .sidebar-panel {
    position: fixed;
    top: 100px; /* Bajo el header +20px */
    left: 0;
    height: calc(100vh - 100px);
    width: 180px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 101;
}

.main {
    margin-left: 180px; /* Igual al ancho de la sidebar */
    width: 100%;
    padding: 24px;
}

.sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar li {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-color);
    background: #f4f4f4;
    transition: background 0.2s;
}
.sidebar li.active, .sidebar li:hover {
    background: #e0f0ff;
}

.sidebar-panel .tab-btn {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border: none;
    background: none;
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}
.sidebar-panel .tab-btn.active, .sidebar-panel .tab-btn:hover {
    background: #e0f0ff;
    color: #005a8c;
}

@media (max-width: 900px) {
    .dashboard-layout { flex-direction: column; margin-top: 80px; }
    .sidebar, .sidebar-panel { position: static; width: 100%; height: auto; top: 0; }
    .main { margin-left: 0; }
}

/* Ajusta el input de archivo para que sea del mismo ancho que el campo Asunto */
.form-group.full-width input[type='file'] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Tooltip para el historial de notificaciones */
.pop-tooltip {
    position: fixed;
    background: #2563eb;
    color: white;
    padding: 8px 0;
    border-radius: 6px;
    text-align: center;
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.2s;
    opacity: 0;
    animation: popIn 0.18s cubic-bezier(.4,2,.6,1) 1;
}

@keyframes popIn {
    0% { opacity: 0; transform: translateY(10px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.pop-trigger {
    transition: background-color 0.2s ease;
}

.pop-trigger:hover {
    background-color: rgba(37, 99, 235, 0.05);
} 