/**
 * Directorio Farmacéutico - Core Styles
 *
 * Estilos mínimos funcionales que NO dependen del diseño visual.
 * Estos estilos son para funcionalidades básicas como:
 * - Estados de carga (loading)
 * - Mensajes de feedback AJAX
 * - Accesibilidad (screen reader)
 * - Estados de error/éxito básicos
 *
 * Nota: Si estás usando el tema dirfarm-theme con Tailwind,
 * estos estilos NO se cargarán (el tema maneja todo el diseño).
 *
 * @package Directorio_Farmaceutico
 * @since 1.1.0
 */

/* ==========================================================================
   UTILIDADES FUNCIONALES
   ========================================================================== */

/* Screen reader only */
.dirfarm-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hidden elements */
.dirfarm-hidden {
    display: none !important;
}

/* ==========================================================================
   ESTADOS DE CARGA
   ========================================================================== */

.dirfarm-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.dirfarm-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid #e5e7eb;
    border-top-color: #562380;
    border-radius: 50%;
    animation: dirfarm-spin 0.8s linear infinite;
}

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

/* Spinner inline */
.dirfarm-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: dirfarm-spin 0.8s linear infinite;
    vertical-align: middle;
}

/* ==========================================================================
   MENSAJES DE FEEDBACK
   ========================================================================== */

.dirfarm-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.dirfarm-message-success {
    background-color: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.dirfarm-message-error {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.dirfarm-message-warning {
    background-color: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
}

.dirfarm-message-info {
    background-color: #dbeafe;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* ==========================================================================
   BOTONES BÁSICOS (Fallback)
   ========================================================================== */

.dirfarm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dirfarm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dirfarm-btn-primary {
    background-color: #562380;
    color: #ffffff;
}

.dirfarm-btn-primary:hover:not(:disabled) {
    background-color: #441d66;
}

.dirfarm-btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.dirfarm-btn-secondary:hover:not(:disabled) {
    background-color: #e5e7eb;
}

/* ==========================================================================
   FORMULARIOS BÁSICOS (Fallback)
   ========================================================================== */

.dirfarm-input,
.dirfarm-select,
.dirfarm-textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dirfarm-input:focus,
.dirfarm-select:focus,
.dirfarm-textarea:focus {
    outline: none;
    border-color: #562380;
    box-shadow: 0 0 0 3px rgba(86, 35, 128, 0.1);
}

.dirfarm-input:disabled,
.dirfarm-select:disabled,
.dirfarm-textarea:disabled {
    background-color: #e5e7eb;
    cursor: not-allowed;
}

.dirfarm-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.dirfarm-label-required::after {
    content: ' *';
    color: #dc2626;
}

/* ==========================================================================
   NOTIFICACIONES TOAST
   ========================================================================== */

.dirfarm-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dirfarm-toast {
    padding: 14px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: dirfarm-toast-in 0.3s ease;
    max-width: 360px;
}

.dirfarm-toast-success {
    background-color: #065f46;
    color: #ffffff;
}

.dirfarm-toast-error {
    background-color: #991b1b;
    color: #ffffff;
}

@keyframes dirfarm-toast-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==========================================================================
   ACCESIBILIDAD
   ========================================================================== */

/* Focus visible para teclado */
.dirfarm-btn:focus-visible,
.dirfarm-input:focus-visible,
.dirfarm-select:focus-visible {
    outline: 2px solid #562380;
    outline-offset: 2px;
}

/* Reducir movimiento para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
    .dirfarm-loading::after,
    .dirfarm-spinner,
    .dirfarm-toast {
        animation: none;
    }
}

/* ==========================================================================
   RESPONSIVE BÁSICO
   ========================================================================== */

@media (max-width: 640px) {
    .dirfarm-toast-container {
        left: 20px;
        right: 20px;
    }

    .dirfarm-toast {
        max-width: none;
    }
}
