/* ==========================================================================
   SISTEMA DE DISEÑO & VARIABLES DE ESTILO
   ========================================================================== */
:root {
    /* Tipografía */
    --font-header: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Paleta de Colores Principal */
    --bg-dark: #07090e;
    --bg-slate: #0d1117;
    --card-bg: rgba(18, 22, 33, 0.65);
    --card-border: rgba(255, 255, 255, 0.07);
    
    /* Colores de Acento Gastronómico */
    --accent-orange: #ff6b35;
    --accent-orange-glow: rgba(255, 107, 53, 0.15);
    --accent-red: #e84855;
    --accent-red-glow: rgba(232, 72, 85, 0.15);
    --accent-gold: #ffb03a;
    --accent-gold-glow: rgba(255, 176, 58, 0.15);
    --accent-teal: #14b8a6;
    --accent-teal-glow: rgba(20, 184, 166, 0.15);
    
    /* Estados y Utilidades */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.1);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.2);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.2);
    
    /* Sombras y Efectos */
    --card-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
    --input-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ==========================================================================
   RESET & ESTILOS BASE
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 20px;
}

/* ==========================================================================
   FONDO DE GRADIENTES INTERACTIVOS (ORBES BRILLANTES)
   ========================================================================== */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background-radial: radial-gradient(circle at 50% 50%, #0d111a, #07090e);
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    mix-blend-mode: screen;
    pointer-events: none;
}

.orb-1 {
    top: -10%;
    right: 10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--accent-orange), transparent 70%);
    animation: float-orb-1 25s infinite alternate ease-in-out;
}

.orb-2 {
    bottom: -10%;
    left: 10%;
    width: 55vw;
    height: 55vw;
    background: radial-gradient(circle, var(--accent-red), transparent 70%);
    animation: float-orb-2 30s infinite alternate ease-in-out;
}

@keyframes float-orb-1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-10%, 15%) scale(1.1); }
}

@keyframes float-orb-2 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(15%, -10%) scale(1.05); }
}

/* ==========================================================================
   ESTRUCTURA DE CONTENIDO
   ========================================================================== */
.admin-container {
    width: 100%;
    max-width: 580px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 10;
    margin: auto 0;
}

/* Cabecera */
.admin-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-emoji {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px var(--accent-orange));
    animation: heartbeat 2s infinite ease-in-out;
}

.brand-logo h1 {
    font-family: var(--font-header);
    font-weight: 800;
    font-size: 2.2rem;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.admin-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Badge de Estado en Vivo */
.header-status {
    margin-top: 4px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
    transition: var(--transition-smooth);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-dot.pulsing {
    animation: pulse-dot 1.5s infinite;
}

.status-badge.online {
    color: #e2e8f0;
    border-color: rgba(16, 185, 129, 0.25);
    background: rgba(16, 185, 129, 0.06);
}

.status-badge.online .status-dot {
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.status-badge.offline {
    color: #e2e8f0;
    border-color: rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.06);
}

.status-badge.offline .status-dot {
    background-color: var(--error);
    box-shadow: 0 0 10px var(--error);
}

@keyframes pulse-dot {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.12); }
    28% { transform: scale(1); }
    42% { transform: scale(1.12); }
    70% { transform: scale(1); }
}

/* ==========================================================================
   TARJETA PRINCIPAL (GLASSMORPHISM)
   ========================================================================== */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 36px;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

/* Línea de Brillo Superior */
.card-glow-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-red), var(--accent-gold), var(--accent-teal));
    background-size: 300% 100%;
    animation: gradient-shift 10s infinite alternate linear;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

.card-header {
    margin-bottom: 30px;
}

.card-header h2 {
    font-family: var(--font-header);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.45;
}

/* ==========================================================================
   FORMULARIO & COMPONENTES INTERACTIVOS
   ========================================================================== */
#menu-form {
    display: flex;
    flex-direction: column;
}

.form-content {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: var(--transition-smooth);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    transition: var(--transition-fast);
}

.input-icon {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

/* Envoltura del Input */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-group input {
    width: 100%;
    height: 56px;
    background-color: rgba(10, 12, 17, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    padding: 0 45px 0 18px;
    outline: none;
    box-shadow: var(--input-shadow);
    transition: var(--transition-smooth);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.95rem;
}

/* Botón de Limpiar Integrado */
.clear-btn {
    position: absolute;
    right: 14px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
    display: none; /* Se activa por JS */
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: var(--text-primary);
}

/* Foco y Acentos Dinámicos de Iluminación por Campo */
.form-group[data-accent="chicken"] input:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 15px var(--accent-gold-glow), var(--input-shadow);
}
.form-group[data-accent="chicken"]:focus-within label {
    color: var(--accent-gold);
}
.form-group[data-accent="chicken"]:focus-within .input-icon {
    transform: scale(1.15);
}

.form-group[data-accent="pork"] input:focus {
    border-color: var(--accent-orange);
    box-shadow: 0 0 15px var(--accent-orange-glow), var(--input-shadow);
}
.form-group[data-accent="pork"]:focus-within label {
    color: var(--accent-orange);
}
.form-group[data-accent="pork"]:focus-within .input-icon {
    transform: scale(1.15);
}

.form-group[data-accent="beef"] input:focus {
    border-color: var(--accent-red);
    box-shadow: 0 0 15px var(--accent-red-glow), var(--input-shadow);
}
.form-group[data-accent="beef"]:focus-within label {
    color: var(--accent-red);
}
.form-group[data-accent="beef"]:focus-within .input-icon {
    transform: scale(1.15);
}

.form-group[data-accent="soup"] input:focus {
    border-color: var(--accent-teal);
    box-shadow: 0 0 15px var(--accent-teal-glow), var(--input-shadow);
}
.form-group[data-accent="soup"]:focus-within label {
    color: var(--accent-teal);
}
.form-group[data-accent="soup"]:focus-within .input-icon {
    transform: scale(1.15);
}

/* ==========================================================================
   BOTÓN DE ENVÍO CON CARGADORES
   ========================================================================== */
.form-actions {
    margin-top: 10px;
}

.submit-btn {
    width: 100%;
    height: 58px;
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-red) 100%);
    border: none;
    border-radius: 16px;
    color: white;
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 24px -6px rgba(255, 107, 53, 0.4);
    transition: var(--transition-smooth);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -4px rgba(255, 107, 53, 0.55),
                0 0 20px rgba(232, 72, 85, 0.2);
    background: linear-gradient(135deg, #ff7b4b 0%, #eb5c68 100%);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 4px 12px -3px rgba(255, 107, 53, 0.4);
}

/* Estado Cargando del Botón */
.submit-btn .btn-loader {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: scale(0.6);
    transition: var(--transition-smooth);
}

.submit-btn .btn-text {
    transition: var(--transition-smooth);
}

.submit-btn:disabled {
    cursor: not-allowed;
}

.submit-btn.saving {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.5) 0%, rgba(232, 72, 85, 0.5) 100%);
    box-shadow: none;
}

.submit-btn.saving .btn-text {
    opacity: 0;
    transform: translateY(15px);
}

.submit-btn.saving .btn-loader {
    opacity: 1;
    transform: scale(1);
}

/* Spinner SVG */
.spinner {
    animation: rotate 2s linear infinite;
    width: 28px;
    height: 28px;
}

.spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* ==========================================================================
   LOADING SKELETONS (Para el GET Inicial)
   ========================================================================== */
.skeletons-wrapper {
    display: none;
    flex-direction: column;
    gap: 22px;
}

/* Cuando el formulario tiene la clase loading, maneja la visibilidad */
#menu-form.loading .skeletons-wrapper {
    display: flex;
}

#menu-form.loading .form-content {
    display: none;
}

.skeleton-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-title {
    width: 140px;
    height: 18px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton-input {
    width: 100%;
    height: 56px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Efecto Shimmer de Luz en Movimiento */
.skeleton-title::after,
.skeleton-input::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.04) 30%, 
        rgba(255, 255, 255, 0.08) 50%, 
        rgba(255, 255, 255, 0.04) 70%, 
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

@keyframes shimmer {
    0% { background-position: -150% 0; }
    100% { background-position: 150% 0; }
}

/* ==========================================================================
   SISTEMA DE NOTIFICACIONES TOAST (Premium Glassmorphic Alerts)
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 380px;
    pointer-events: none;
}

.toast {
    background: rgba(18, 22, 33, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 16px;
    padding: 16px 20px;
    color: var(--text-primary);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    pointer-events: auto;
    
    /* Animación de Entrada */
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    animation: toast-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: var(--transition-smooth);
}

.toast.toast-exit {
    animation: toast-out 0.3s ease forwards;
}

.toast-icon {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.toast-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toast-title {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.2px;
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Variaciones de Toasts */
.toast-success {
    border-left: 4px solid var(--success);
}
.toast-success .toast-icon {
    background: var(--success-glow);
    color: var(--success);
    box-shadow: 0 0 10px var(--success-glow);
}

.toast-error {
    border-left: 4px solid var(--error);
}
.toast-error .toast-icon {
    background: var(--error-glow);
    color: var(--error);
    box-shadow: 0 0 10px var(--error-glow);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}
.toast-warning .toast-icon {
    background: var(--warning-glow);
    color: var(--warning);
    box-shadow: 0 0 10px var(--warning-glow);
}

@keyframes toast-in {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(50px) scale(0.9);
    }
}

/* ==========================================================================
   PIE DE PÁGINA
   ========================================================================== */
.admin-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   MEDIAS QUERIES & RESPONSIVIDAD (MOBILE FIRST)
   ========================================================================== */
@media (max-width: 600px) {
    body {
        padding: 16px;
        align-items: flex-start;
    }
    
    .admin-container {
        margin: 10px 0;
        gap: 20px;
    }
    
    .brand-logo h1 {
        font-size: 1.8rem;
    }
    
    .glass-card {
        padding: 24px 20px;
        border-radius: 20px;
    }
    
    .card-header {
        margin-bottom: 24px;
    }
    
    .card-header h2 {
        font-size: 1.35rem;
    }
    
    .form-group input {
        height: 52px;
        font-size: 0.95rem;
        padding-left: 14px;
    }
    
    .submit-btn {
        height: 54px;
        font-size: 0.98rem;
    }
    
    /* En móviles el toast se apila centrado arriba */
    .toast-container {
        top: 16px;
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
    }
    
    @keyframes toast-out {
        to {
            opacity: 0;
            transform: translateY(-20px) scale(0.9);
        }
    }
}
