/**
 * Estilos para notificaciones en frontend
 * Sistema de Recordatorios y Notificaciones
 */

/* Overlay */
.srn-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    animation: srnFadeIn 0.3s ease-out;
}

/* Contenedor de notificaciones */
#srn-notificaciones-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px 0;
}

/* Scrollbar personalizado */
#srn-notificaciones-container::-webkit-scrollbar {
    width: 8px;
}

#srn-notificaciones-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

#srn-notificaciones-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

#srn-notificaciones-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Notificación individual */
.srn-notificacion {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: srnSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

/*
 * Efecto pulsátil para resaltar notificaciones (frontend)
 * Se aplica mediante la clase .srn-pulsatil (por defecto a prioridad alta y crítica).
 */
.srn-notificacion.srn-pulsatil {
    animation: srnSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), srnBreath 2.0s ease-in-out infinite;
}

.srn-notificacion.srn-pulsatil::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 0 0 rgba(255, 185, 0, 0.45);
    animation: srnPulseRing 1.8s ease-out infinite;
}

@keyframes srnBreath {
    0%, 100% { transform: translateZ(0); }
    50% { transform: translateZ(0) scale(1.01); }
}

@keyframes srnPulseRing {
    0% { box-shadow: 0 0 0 0 rgba(255, 185, 0, 0.45); }
    70% { box-shadow: 0 0 0 14px rgba(255, 185, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 185, 0, 0); }
}

/* Borde superior según prioridad */
.srn-notificacion::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.srn-notificacion.srn-prioridad-baja::before {
    background: #46b450;
}

.srn-notificacion.srn-prioridad-media::before {
    background: #ffb900;
}

.srn-notificacion.srn-prioridad-alta::before {
    background: #ff8c00;
}

.srn-notificacion.srn-prioridad-critica::before {
    background: #dc3232;
    animation: srnPulse 2s infinite;
}

/* Header de la notificación */
.srn-notificacion-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.srn-notificacion-icono {
    font-size: 32px;
    line-height: 1;
}

.srn-notificacion-titulo-wrapper {
    flex: 1;
}

.srn-notificacion-titulo {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.srn-notificacion-prioridad {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
    font-weight: 500;
    text-transform: uppercase;
}

.srn-prioridad-baja .srn-notificacion-prioridad {
    background: #e7f5e7;
    color: #2d6e2d;
}

.srn-prioridad-media .srn-notificacion-prioridad {
    background: #fff8e5;
    color: #856404;
}

.srn-prioridad-alta .srn-notificacion-prioridad {
    background: #ffe5cc;
    color: #8c4400;
}

.srn-prioridad-critica .srn-notificacion-prioridad {
    background: #ffe5e5;
    color: #8c1414;
}

.srn-notificacion-cerrar {
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.srn-notificacion-cerrar:hover {
    background: #f0f0f0;
    color: #333;
}

.srn-notificacion-cerrar .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* Body de la notificación */
.srn-notificacion-body {
    padding: 20px;
}

.srn-notificacion-contenido {
    margin-bottom: 20px;
    color: #555;
    line-height: 1.6;
    font-size: 15px;
}

.srn-notificacion-contenido p {
    margin: 0 0 10px 0;
}

.srn-notificacion-contenido p:last-child {
    margin-bottom: 0;
}

/* Metadata */
.srn-notificacion-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.srn-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.srn-meta-icon {
    font-size: 18px;
}

.srn-meta-label {
    font-weight: 500;
    color: #666;
}

.srn-meta-value {
    color: #333;
}

.srn-dias-restantes {
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
}

.srn-dias-restantes .srn-meta-value {
    font-weight: bold;
}

.srn-meta-value.vencido {
    color: #dc3232;
}

.srn-meta-value.urgente {
    color: #ff6900;
}

.srn-meta-value.proximo {
    color: #ffb900;
}

/* Footer de la notificación */
.srn-notificacion-footer {
    padding: 15px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Botones */
.srn-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.srn-btn-primary {
    background: #0073aa;
    color: white;
    width: 100%;
}

.srn-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.srn-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.srn-btn-secondary:hover {
    background: #e0e0e0;
}

/* Opciones de posponer */
.srn-posponer-opciones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

/* Mensaje temporal */
.srn-mensaje-temporal {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #46b450;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    animation: srnSlideInRight 0.3s ease-out;
    font-weight: 500;
}

/* Animaciones */
@keyframes srnFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes srnFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes srnSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes srnSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100px) scale(0.95);
    }
}

@keyframes srnSlideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes srnPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Responsive */
@media (max-width: 768px) {
    #srn-notificaciones-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .srn-notificacion-header {
        padding: 15px;
    }
    
    .srn-notificacion-body {
        padding: 15px;
    }
    
    .srn-notificacion-footer {
        padding: 12px 15px 15px 15px;
    }
    
    .srn-notificacion-titulo {
        font-size: 18px;
    }
    
    .srn-notificacion-icono {
        font-size: 24px;
    }
    
    .srn-posponer-opciones {
        grid-template-columns: 1fr;
    }
    
    .srn-mensaje-temporal {
        bottom: 20px;
        right: 20px;
        left: 20px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    #srn-notificaciones-container {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: none;
        padding: 10px;
    }
    
    .srn-notificacion {
        border-radius: 8px;
    }
}

/* Accesibilidad */
.srn-notificacion:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.srn-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
    .srn-notificacion {
        background: #2c2c2c;
        color: #e0e0e0;
    }
    
    .srn-notificacion-titulo {
        color: #ffffff;
    }
    
    .srn-notificacion-contenido {
        color: #cccccc;
    }
    
    .srn-notificacion-meta {
        background: #1a1a1a;
    }
    
    .srn-meta-label {
        color: #999999;
    }
    
    .srn-meta-value {
        color: #e0e0e0;
    }
    
    .srn-btn-secondary {
        background: #3a3a3a;
        color: #e0e0e0;
    }
    
    .srn-btn-secondary:hover {
        background: #4a4a4a;
    }
}

/* Estado de carga */
.srn-loading-indicator {
    text-align: center;
    padding: 40px;
    color: #666;
}

.srn-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 115, 170, 0.2);
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   ESTILOS PARA SHORTCODE LISTA
   ======================================== */

.srn-shortcode-lista {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.srn-recordatorio-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #ccc;
    transition: all 0.3s ease;
}

.srn-recordatorio-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.srn-card-prioridad-baja { border-left-color: #46b450; }
.srn-card-prioridad-media { border-left-color: #ffb900; }
.srn-card-prioridad-alta { border-left-color: #ff8c00; }
.srn-card-prioridad-critica { border-left-color: #dc3232; }

.srn-card-vencido { background: #ffe5e5; }
.srn-card-urgente { background: #fff8e5; }

.srn-card-header {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 15px;
}

.srn-card-icono {
    font-size: 32px;
    line-height: 1;
}

.srn-card-titulo-wrapper {
    flex: 1;
}

.srn-card-titulo {
    margin: 0 0 10px 0;
    font-size: 20px;
    color: #333;
}

.srn-card-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.srn-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.srn-badge-prioridad.srn-badge-baja { background: #e7f5e7; color: #2d6e2d; }
.srn-badge-prioridad.srn-badge-media { background: #fff8e5; color: #856404; }
.srn-badge-prioridad.srn-badge-alta { background: #ffe5cc; color: #8c4400; }
.srn-badge-prioridad.srn-badge-critica { background: #ffe5e5; color: #8c1414; }

.srn-badge-estado.srn-badge-pendiente { background: #fff8e5; color: #856404; }
.srn-badge-estado.srn-badge-en_proceso { background: #e5f3ff; color: #004085; }

/* Badge pulsátil (llamativo) - Prioridad */
.srn-badge-prioridad.srn-badge-pulse{
    position: relative;
    animation: srnBadgePulse 1.6s ease-out infinite;
}

/* Colores del pulso según prioridad */
.srn-badge-prioridad.srn-badge-baja.srn-badge-pulse{
    --srnPulse: rgba(70, 180, 80, 0.55);
}
.srn-badge-prioridad.srn-badge-media.srn-badge-pulse{
    --srnPulse: rgba(133, 100, 4, 0.45);
}
.srn-badge-prioridad.srn-badge-alta.srn-badge-pulse{
    --srnPulse: rgba(245, 158, 11, 0.55);
}
.srn-badge-prioridad.srn-badge-critica.srn-badge-pulse{
    --srnPulse: rgba(220, 53, 69, 0.55);
}

@keyframes srnBadgePulse{
    0%{ transform: scale(1); box-shadow: 0 0 0 0 var(--srnPulse); }
    70%{ transform: scale(1.03); box-shadow: 0 0 0 12px rgba(0,0,0,0); }
    100%{ transform: scale(1); box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* Respeta accesibilidad */
@media (prefers-reduced-motion: reduce){
    .srn-badge-prioridad.srn-badge-pulse{ animation: none; }
}

.srn-badge-estado.srn-badge-completada { background: #e7f5e7; color: #2d6e2d; }
.srn-badge-estado.srn-badge-cancelada { background: #f0f0f0; color: #666; }

.srn-card-contenido {
    margin-bottom: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    color: #555;
    line-height: 1.6;
}

.srn-card-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.srn-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.srn-meta-icon {
    font-size: 18px;
}

.srn-meta-texto strong {
    color: #333;
}

.srn-dias-vencido { color: #dc3232; font-weight: bold; }
.srn-dias-urgente { color: #ff6900; font-weight: bold; }

.srn-shortcode-empty {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
}

/* ========================================
   ESTILOS DE ACCIONES (BOTONES)
   ======================================== */

.srn-card-acciones {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

.srn-acciones-estados,
.srn-acciones-gestion {
    margin-bottom: 10px;
}

.srn-acciones-label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    display: block;
    margin-bottom: 8px;
}

.srn-btn-accion {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    color: #333;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-right: 8px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.srn-btn-accion:hover:not(:disabled) {
    background: #f5f5f5;
    border-color: #bbb;
    transform: translateY(-1px);
}

.srn-btn-accion:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9f9f9;
}

.srn-btn-completar:not(:disabled) {
    background: #e7f5e7;
    border-color: #46b450;
    color: #2d6e2d;
}

.srn-btn-completar:not(:disabled):hover {
    background: #d4edda;
}

.srn-btn-editar {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.srn-btn-editar:hover {
    background: #bbdefb;
}

.srn-btn-eliminar {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.srn-btn-eliminar:hover {
    background: #ffcdd2;
}

/* Mensajes de éxito/error */
.srn-mensaje-frontend {
    position: fixed;
    bottom: -100px;
    right: 30px;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    font-weight: 500;
    font-size: 14px;
    transition: bottom 0.3s ease-out;
    max-width: 400px;
}

.srn-mensaje-frontend.srn-mensaje-visible {
    bottom: 30px;
}

.srn-mensaje-exito {
    background: #46b450;
    color: white;
}

.srn-mensaje-error {
    background: #dc3232;
    color: white;
}

/* Responsive para tarjetas */
@media (max-width: 768px) {
    .srn-card-header {
        flex-direction: column;
    }
    
    .srn-card-icono {
        font-size: 24px;
    }
    
    .srn-card-titulo {
        font-size: 18px;
    }
    
    .srn-btn-accion {
        display: block;
        width: 100%;
        margin-right: 0;
    }
    
    .srn-mensaje-frontend {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}
