/* ==========================================
   CAJAS DE CRISTAL INTERNAS
========================================== */
.inner-glass-box {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    color: var(--text);
    padding: 8px;
    outline: none;
    transition: all 0.3s ease;
}

.inner-glass-box:focus,
.inner-glass-box:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
}

body.dark-mode .inner-glass-box {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 2px 15px rgba(0, 0, 0, 0.4);
    color: white;
}

body.dark-mode .inner-glass-box:focus,
body.dark-mode .inner-glass-box:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================
   DROPDOWN ANIMADO (PLANTILLAS)
========================================== */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    cursor: pointer;
    font-weight: bold;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-content {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    min-width: 150px;
    background: var(--panel-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    z-index: 100;
    overflow: hidden;

    /* Animacion */
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-dropdown.active .dropdown-content {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-content a {
    color: var(--text);
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-weight: bold;
    font-size: 0.9rem;
    transition: 0.2s;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background: var(--accent);
    color: white;
    padding-left: 20px;
}

body.dark-mode .dropdown-content {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .dropdown-content a {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.05);
}


* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #fce4ec;
    /* Fallback */
    color: var(--text);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

/* ==========================================
   ESTILOS GLOBALES DE PANELES Y BOTONES
========================================== */
.section-title {
    color: var(--text);
    font-size: 1.3rem;
    margin: 0 0 10px 0;
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    padding-bottom: 8px;
    font-weight: 800;
    display: flex;
    align-items: center;
}

.btn-pildora {
    background: linear-gradient(135deg, var(--accent-pink), #ff7eb3);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 6px 15px rgba(255, 71, 87, 0.3);
}

.btn-pildora:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 71, 87, 0.4);
}

.btn-pildora:active {
    transform: scale(0.95);
}

.btn-pildora .icon {
    filter: brightness(0) invert(1);
}

/* Iconos blancos en pildoras de color */

.btn-secundario {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid white;
    color: var(--text);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.btn-secundario:hover {
    background: white;
    transform: translateY(-2px);
}

.btn-secundario .icon {
    filter: none;
}

.panel-rango {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1 1 45%;
    background: var(--panel);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.panel-rango label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: bold;
}

.panel-rango input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Menú de Modos (Vista / Edición) */
.mode-toggle-bar {
    display: flex;
    gap: 8px;
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-sizing: border-box;
}

.mode-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-weight: bold;
    font-size: clamp(0.82rem, 2vw, 0.9rem);
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
}

.mode-btn small {
    font-size: clamp(0.65rem, 1.8vw, 0.72rem);
    font-weight: normal;
    line-height: 1.25;
    margin-top: 3px;
    display: block;
}

@media (max-width: 520px) {
    .mode-toggle-bar {
        flex-direction: column;
        gap: 6px;
        padding: 6px;
    }

    .mode-btn {
        width: 100%;
        padding: 10px 8px;
    }
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: white;
    color: var(--accent);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.mode-btn.active-edit {
    background: var(--accent-pink);
    color: white;
    box-shadow: 0 5px 15px rgba(255, 71, 87, 0.3);
}

/* ==========================================
   FAB (FLOATING ACTION BUTTON) TEMAS
========================================== */
.fab-container {
    position: fixed;
    bottom: 30px;
    right: 15px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 15px;
    transition: all 0.3s ease;
}

.fab-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-btn:hover {
    transform: scale(1.1) rotate(15deg);
    background: rgba(255, 255, 255, 0.8);
}

.fab-btn .icon-sm {
    width: 24px;
    height: 24px;
    filter: none;
    opacity: 0.8;
}

.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fab-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.fab-item {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 50px;
    color: var(--text);
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.fab-item:hover {
    background: white;
    transform: translateX(-5px);
}

.fab-color-dot {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    display: inline-block;
}

/* Responsividad para el botÃƒÂ³n flotante (Celulares) */
@media(max-width: 768px) {
    .fab-container {
        bottom: 40px;
        right: 10px;
        gap: 30px;
    }

    .fab-btn {
        width: 50px;
        height: 50px;
    }

    .fab-btn .icon-sm {
        width: 20px;
        height: 20px;
    }

    .fab-item {
        font-size: 0.8rem;
        padding: 8px 15px;
    }
}

/* ==========================================
   MODALES (BIENVENIDA, CHANGELOG, LOADER)
========================================== */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background: rgba(0, 0, 0, 0.45);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    opacity: 1;
    visibility: visible;
}

.global-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeInModal 0.5s ease;
}

#globalLoaderText {
    text-align: center;
    max-width: 520px;
    padding: 0 15px;
    line-height: 1.5;
}

.overlay-ia {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ia-box {
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid white;
    border-radius: 24px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
}

.ia-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--accent-pink);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.overlay-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeInModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-box {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid white;
    border-radius: 24px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    text-align: left;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    color: var(--text);
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 900;
}

.modal-body {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 30px;
}

.modal-list {
    list-style: none;
    padding: 0;
    margin: 20px 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-list li {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid var(--accent);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.modal-list li b {
    color: var(--text);
    display: block;
    margin-bottom: 4px;
    font-size: 1.05rem;
}

.btn-modal-action {
    width: 100%;
    font-size: 1.1rem;
    padding: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==========================================
   MODAL DE CHANGELOG / NOVEDADES ADAPTABLE
========================================== */
.modal-box-changelog {
    width: min(92vw, 680px) !important;
    max-width: 680px !important;
    max-height: 85vh !important;
    padding: 24px 22px 20px 22px !important;
    border-radius: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4), 0 0 25px rgba(255, 215, 0, 0.15) !important;
}

@media (min-width: 601px) and (max-width: 1024px) {
    /* Tablet */
    .modal-box-changelog {
        width: min(88vw, 640px) !important;
        max-width: 640px !important;
        max-height: 84vh !important;
        padding: 24px 22px 18px 22px !important;
    }
}

@media (min-width: 1025px) {
    /* Desktop */
    .modal-box-changelog {
        width: 680px !important;
        max-width: 680px !important;
        max-height: 82vh !important;
        padding: 28px 26px 22px 26px !important;
    }
}

@media (max-width: 480px) {
    /* Móviles */
    .modal-box-changelog {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 88vh !important;
        padding: 16px 12px 14px 12px !important;
        border-radius: 16px !important;
    }
}

.modal-box-changelog .modal-title {
    flex-shrink: 0 !important;
    margin-bottom: 12px !important;
    font-size: clamp(1.15rem, 3.5vw, 1.45rem) !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.modal-box-changelog .modal-body {
    flex: 1 1 auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    padding-right: 6px !important;
    margin-bottom: 12px !important;
    overscroll-behavior: contain !important;
}

.modal-box-changelog .modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-box-changelog .modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

.modal-box-changelog .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.35);
    border-radius: 4px;
}

.modal-box-changelog .modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gold);
}

.modal-box-changelog .btn-modal-action {
    flex-shrink: 0 !important;
    margin-top: auto !important;
    padding: 14px 18px !important;
    font-size: clamp(0.92rem, 2.4vw, 1.05rem) !important;
    border-radius: 12px !important;
    width: 100% !important;
}

/* ==========================================
   UBICACIÓN DE BOTONES FLOTANTES INDIVIDUALES
========================================== */

/* Configuraciones base para que funcionen por separado */
.fab-wrap-theme {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    /* El menú sale hacia arriba */
    align-items: flex-end;
    gap: 15px;
}

.fab-wrap-history,
.fab-wrap-dark,
.fab-wrap-changelog {
    position: fixed;
    z-index: 9999;
}

/* 1. Posición en PC y Tablets (Pantallas grandes) */
@media (min-width: 769px) {
    .fab-wrap-history {
        bottom: 30px;
        right: 20px;
    }

    .fab-wrap-dark {
        bottom: 100px;
        right: 20px;
    }

    .fab-wrap-theme {
        bottom: 170px;
        right: 20px;
    }

    .fab-wrap-changelog {
        bottom: 240px;
        right: 20px;
    }
}

/* 2. Posición en Celulares (Pantallas pequeñas) */
@media (max-width: 768px) {
    .fab-wrap-history {
        bottom: 20px;
        right: 15px;
    }

    .fab-wrap-dark {
        bottom: 85px;
        right: 15px;
    }

    .fab-wrap-theme {
        bottom: 150px;
        right: 15px;
    }

    .fab-wrap-changelog {
        bottom: 215px;
        right: 15px;
    }
}

/* ==========================================
   ESTADOS DE BOTONES Y LOGS DE IMPORTACIÓN
========================================== */
.btn-import-success {
    background: #4caf50 !important;
    background-image: linear-gradient(135deg, #4caf50, #2e7d32) !important;
    color: #ffffff !important;
    border-color: #4caf50 !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.45) !important;
}

.btn-import-error {
    background: #e91e63 !important;
    background-image: linear-gradient(135deg, #ff3366, #c2185b) !important;
    color: #ffffff !important;
    border-color: #ff3366 !important;
    box-shadow: 0 4px 15px rgba(255, 51, 102, 0.55) !important;
    animation: btnShake 0.4s ease-in-out;
}

@keyframes btnShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.modal-box-log {
    background: rgba(18, 18, 28, 0.96) !important;
    border: 2px solid #ff3366 !important;
    border-radius: 20px !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(255, 51, 102, 0.3) !important;
    color: #eee !important;
    max-width: 540px !important;
    padding: 26px !important;
    animation: popInModal 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-box-log.log-corrupto {
    border-color: #ff9800 !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(255, 152, 0, 0.35) !important;
}

.modal-box-log.log-exito {
    border-color: #4caf50 !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(76, 175, 80, 0.35) !important;
}

@keyframes popInModal {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.toast-import-feedback {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 999999;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.92rem;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toast-import-feedback.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast-import-feedback.toast-error {
    background: rgba(233, 30, 99, 0.95);
    border: 1px solid #ff3366;
    box-shadow: 0 8px 25px rgba(255, 51, 102, 0.5);
}

.toast-import-feedback.toast-warning {
    background: rgba(255, 152, 0, 0.95);
    border: 1px solid #ffb74d;
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.5);
}

.toast-import-feedback.toast-success {
    background: rgba(76, 175, 80, 0.95);
    border: 1px solid #81c784;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.5);
}