/* =========================================
   3. COMPONENTES (WIDGETS)
   ========================================= */

/* Botones del Menú */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.nav-btn:hover:not(.active) {
    background-color: var(--bg-input);
    color: var(--primary);
}

.nav-btn.active {
    background: color-mix(in srgb, var(--nav-active), transparent 85%);
    color: var(--nav-active);
    /* Full rounded pill style instead of border-left */
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--nav-active), transparent 90%);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--nav-active), transparent 95%);
    font-weight: 700;
}

/* Dynamic Gradient Buttons */
.fluid-gradient-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, color-mix(in srgb, var(--primary), white 20%) 100%);
    background-size: 200% 200%;
}

.active-nav-gradient {
    background: linear-gradient(90deg, var(--nav-active) 0%, color-mix(in srgb, var(--nav-active), black 20%) 100%);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    transition: all 0.3s;
}




/* Inputs "Píldora" */
.input-pill-group {
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 999px;
    padding: 0 1.25rem;
    height: 3.5rem;
    width: 100%;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.input-pill-group:focus-within {
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 4px var(--glow-primary);
}

.input-pill-group input {
    flex: 1;
    background: transparent;
    border: none;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
    font-weight: 600;
    height: 100%;
    width: 100%;
}

.input-pill-group .material-symbols-rounded {
    color: var(--primary);
    margin-right: 0.75rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    user-select: none;
}

/* Botones de Acción - Clean & Flat */
.btn-primary {
    background: var(--primary);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04), 0 0 15px var(--glow-primary);
    filter: brightness(1.1);
}

.fluid-gradient-btn {
    background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary), white 15%) 100%);
    background-size: 100%;
}



.btn-primary:active {
    transform: translateY(0) scale(0.98);
}


/* Tarjetas */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .card {
        padding: 1.5rem;
        border-radius: 1.5rem;
    }
}

.card:hover {
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

/* --- INPUTS & CONTROLS --- */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    background-color: var(--bg-input) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    outline: none;
    transition: all 0.2s;
    font-family: var(--font-display);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--glow-primary);
}

/* Calendario Grid Mejorado */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .calendar-grid {
        gap: 6px;
    }
}

.calendar-day {
    aspect-ratio: 1;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: var(--bg-card);
    color: var(--text-main);
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .calendar-day {
        aspect-ratio: auto;
        min-height: 110px;
    }
}

.calendar-day:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
    box-shadow: none;
}

/* Estados del Calendario Refinados */
.calendar-day.full-available {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05), rgba(34, 197, 94, 0.1));
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.calendar-day.partially-booked {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.1));
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.calendar-day.full-booked {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.05), rgba(239, 68, 68, 0.1));
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
    opacity: 0.7;
}

.day-num {
    font-size: 1.1rem;
    font-weight: 700;
    z-index: 2;
}

@media (max-height: 700px) {
    .calendar-grid {
        gap: 8px;
    }

    .calendar-day {
        border-radius: 12px;
    }

    .day-num {
        font-size: 1rem;
    }
}

@media (max-width: 640px) {
    .day-num {
        font-size: 0.9rem;
    }

    .calendar-day {
        border-radius: 10px;
    }
}

.slot-count {
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 4px;
    opacity: 0.9;
}

@media (max-width: 640px) {
    .slot-count {
        font-size: 0.6rem;
        margin-top: 2px;
    }
}

/* --- GESTOR DE HORARIOS MEJORADO --- */
.schedule-block-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
    border-left: 5px solid var(--primary);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

@media (max-width: 640px) {
    .schedule-block-card {
        padding: 1.25rem;
        border-radius: 1rem;
        margin-bottom: 1.25rem;
    }
}

.mini-day-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.day-circle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.day-circle:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.day-circle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.hours-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: end;
}

@media (max-width: 640px) {
    .hours-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-bottom: 1.5rem;
    }
}

.smart-time-group {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.5rem 1rem;
    height: 4rem;
    transition: all 0.2s;
    gap: 1rem;
}

/* INPUTS DE TIEMPO LIMPIOS */
.time-text-input {
    flex: 1;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 1.5rem !important;
    font-weight: 700;
    text-align: center;
    color: var(--text-main) !important;
    outline: none;
    padding: 0 !important;
    min-width: 0;
}

/* Helper para inputs con iconos a la izquierda (Configuración) */
.input-with-icon-left {
    padding-left: 3rem !important;
}

.ampm-select {
    border: none !important;
    background: transparent !important;
    color: var(--primary) !important;
    box-shadow: none !important;
    border-radius: 8px;
    padding: 0 10px !important;
    font-weight: 800;
    cursor: pointer;
    text-align-last: center;
    appearance: none;
}

/* Animación y Otros */
.block-spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.mini-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-icon-small {
    padding: 8px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hover-scale {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--border-color);
    border-radius: 2.5rem;
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-shadow: var(--shadow-card);
}

@media (max-width: 640px) {
    .modal-content {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .modal-overlay {
        padding: 0;
    }
}


.large-modal {
    max-width: 1000px;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 768px) {
    .modal-header {
        padding: 1.25rem 1.5rem;
    }
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    /* Asegura que tome el espacio disponible y haga scroll */
    min-height: 0;
    /* Necesario para que flex: 1 funcione con overflow */
}

/* --- SERVICIOS GALLERY --- */
.service-card {
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure equal height in grid */
    min-height: 420px;
    /* Uniform height for mobile */
}

@media (max-width: 640px) {
    .service-card {
        min-height: 380px;
    }
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

.service-card img {
    transition: transform 0.6s ease;
}

.service-card:hover img {
    transform: scale(1.1);
}

.image-preview-placeholder {
    transition: background 0.3s, border-color 0.3s;
}

.image-preview-placeholder:hover {
    background: var(--bg-body) !important;
    border-color: var(--primary) !important;
}

/* --- CONFIGURATION PALETTE & THEME --- */
.color-swatch {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: white;
    outline: 3px solid var(--primary);
    transform: scale(1.1);
}

.theme-card {
    transition: all 0.3s ease;
    border: 2px solid var(--border-color) !important;
    transform: translateY(0);
}

input[name="theme-choice"]:checked+.theme-card {
    border-color: var(--primary) !important;
    background: var(--bg-input) !important;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

#profile-preview-container:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 0 20px rgba(166, 124, 190, 0.2);
    transform: scale(1.02);
}

/* Action Icon Buttons for Cards */
.btn-icon-action {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-input);
    color: var(--text-muted);
}

.btn-icon-action:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px -3px rgba(197, 160, 43, 0.3);
}

.btn-icon-action.danger:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 5px 15px -3px rgba(239, 68, 68, 0.3);
}

.btn-icon-action .material-symbols-rounded {
    font-size: 1.4rem;
}

/* --- DASHBOARD VIEW TOGGLES --- */
.view-toggle-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn:hover {
    color: var(--text-main);
    background: rgba(125, 125, 125, 0.1);
}

.view-toggle-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

/* --- CUSTOM SELECT DROPDOWN (PREMIUM) --- */
.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 100%;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-input);
    /* Coincide con input-pill-group */
    border-radius: 1rem;
    /* Rounded-2xl eq */
    padding: 1rem 1rem 1rem 3rem;
    /* Padding left para el icono absoluto */
    font-size: 0.875rem;
    /* text-sm */
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s;
    height: 3.5rem;
    /* Misma altura que otros inputs */
}

.custom-select-trigger:hover {
    background-color: var(--bg-card);
    box-shadow: 0 0 0 2px var(--primary);
}

.custom-options {
    position: absolute;
    display: none;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-card);
    z-index: 50;
    overflow: hidden;
    padding: 0.5rem;
    animation: fadeInSlide 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.custom-options.open {
    display: block;
}

.custom-option {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-option:hover {
    background-color: var(--bg-input);
    color: var(--primary);
    transform: translateX(5px);
}

.custom-option.selected {
    background-color: var(--primary);
    color: white;
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar for Containers */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

#global-testimonial-images-container {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* --- SUBMENU COLLAPSIBLE --- */
#gestion-menu.hidden {
    display: none;
}

#gestion-menu {
    transition: all 0.3s ease;
}

.nav-btn .material-icons-round#gestion-arrow {
    transition: transform 0.3s ease;
}

/* Reducción de padding para items de submenú */
.nav-btn.sidebar-item {
    transition: background-color 0.2s;
}

#testimonial-images-container,
#testimonial-videos-container,
#service-gallery-container {
    padding: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.input-pill-group {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: 99px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.input-pill-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 15px color-mix(in srgb, var(--primary), transparent 80%);
}

.input-pill-group .material-icons-round {
    color: var(--primary);
    opacity: 0.7;
    margin-left: 1.25rem;
    font-size: 1.25rem;
}

.input-pill-group input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 1.25rem 1.5rem !important;
    color: var(--text-main) !important;
    font-weight: 600 !important;
    outline: none !important;
    box-shadow: none !important;
}

.input-pill-group input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* --- FINANCE PANEL STYLES --- */
.finance-filter-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.finance-filter-btn:hover {
    color: var(--text-main);
    background: rgba(125, 125, 125, 0.1);
}

.finance-filter-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.1);
    font-weight: 700;
}

/* --- ORDER FILTER BUTTONS --- */
.order-filter-btn {
    transition: all 0.2s ease;
}

.order-filter-btn.active {
    background: var(--bg-card) !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.1);
    font-weight: 800 !important;
}

/* --- SCHEDULE EDITOR SMART ACTIONS --- */
.schedule-smart-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-input);
    padding: 0.75rem 1.25rem;
    border-radius: 1.25rem;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.schedule-smart-actions:hover {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary), transparent 96%);
}

.action-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.action-info .material-symbols-rounded {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary), transparent 90%);
    padding: 10px;
    border-radius: 12px;
    font-size: 1.2rem;
}

.info-texts {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    color: var(--text-muted);
}

.info-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-generate-mes {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 1.25rem;
    height: 2.75rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px color-mix(in srgb, var(--primary), transparent 80%);
}

.btn-generate-mes:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--primary), transparent 70%);
}

.btn-generate-mes:active {
    transform: translateY(0);
}

.btn-delete-mes {
    background: transparent;
    color: #ef4444;
    border: 1.5px solid color-mix(in srgb, #ef4444, transparent 85%);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete-mes:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: rotate(5deg);
}

/* --- BUTTON LOADING STATE --- */
.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
    /* Hide original text by default */
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-top: -10px;
    margin-left: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: btn-spin 0.6s linear infinite;
    z-index: 10;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading-text {
    display: none;
}

/* If you want to show text along with spinner */
.btn-loading.with-text {
    color: white !important;
    gap: 12px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.btn-loading.with-text::after {
    position: relative;
    top: 0;
    left: 0;
    margin: 0;
    flex-shrink: 0;
}

/* --- PREFERENCE BUTTONS (TODAY/TOMORROW) --- */
.preference-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.preference-btn.active {
    border-color: var(--primary) !important;
    background: color-mix(in srgb, var(--primary), transparent 92%) !important;
    box-shadow: 0 10px 20px -5px color-mix(in srgb, var(--primary), transparent 85%),
        inset 0 0 0 1px color-mix(in srgb, var(--primary), transparent 80%);
}

.dark .preference-btn.active {
    background: color-mix(in srgb, var(--primary), transparent 85%) !important;
}

.preference-btn.active span.material-symbols-rounded {
    color: var(--primary) !important;
    transform: scale(1.1);
}

.preference-btn.active .info-value {
    color: var(--primary) !important;
}

.preference-btn:not(.active):hover {
    border-color: color-mix(in srgb, var(--primary), transparent 60%);
    background: var(--bg-input);
    transform: translateY(-2px);
}


/* --- PREMIUM LIST ENTRANCE --- */
.animate-entrance {
    animation: entranceFade 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes entranceFade {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Helper for staggered animation delay */
.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

.stagger-5 {
    animation-delay: 0.25s;
}

.stagger-6 {
    animation-delay: 0.3s;
}

.stagger-7 {
    animation-delay: 0.35s;
}

.stagger-8 {
    animation-delay: 0.4s;
}

.stagger-9 {
    animation-delay: 0.45s;
}

.stagger-10 {
    animation-delay: 0.5s;
}

/* Pulse effect for "active" indicators */
.pulse-indicator {
    box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 197, 160, 43), 0.4);
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 197, 160, 43), 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(var(--primary-rgb, 197, 160, 43), 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb, 197, 160, 43), 0);
    }
}

/* Sub-filtros de Tipo de Finanzas (Control de Cobros) */
.finance-type-btn {
    color: var(--text-main);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.4;
}

.finance-type-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    opacity: 1 !important;
    font-weight: 900;
}

.finance-type-btn:hover:not(.active) {
    background: color-mix(in srgb, var(--primary), transparent 90%);
    opacity: 0.8 !important;
}

/* =========================================
   CUSTOM DROPDOWN (VANGUARD PREMIUM)
   ========================================= */

.vanguard-dropdown {
    position: relative;
    width: 100%;
    min-width: 140px;
}

.vanguard-dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.70rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.vanguard-dropdown-trigger:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

.vanguard-dropdown-trigger .material-icons-round {
    font-size: 16px;
    opacity: 0.7;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.vanguard-dropdown.open .vanguard-dropdown-trigger .material-icons-round {
    transform: rotate(180deg);
}

.vanguard-dropdown-value {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* 
  En tablas el z-index es complicado, nos aseguramos de que el padre
  tenga un contexto alto cuando está abierto.
*/
.vanguard-dropdown.open {
    z-index: 50;
}

.vanguard-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 140px;
    width: max-content;
    background: #ffffff; /* Fondo sólido en modo claro */
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transform-origin: top;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-card), 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    padding: 6px;
    z-index: 1000;
}

html.dark .vanguard-dropdown-menu,
[data-theme="dark"] .vanguard-dropdown-menu {
    background: #18181c; /* Fondo sólido en modo oscuro para evitar transparencias molestas */
}

.vanguard-dropdown.open .vanguard-dropdown-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.vanguard-dropdown-up .vanguard-dropdown-menu {
    top: auto;
    bottom: calc(100% + 6px);
    transform-origin: bottom;
    transform: translateY(10px) scale(0.95);
}

.vanguard-dropdown-up.open .vanguard-dropdown-menu {
    transform: translateY(0) scale(1);
}

.vanguard-dropdown-item {
    padding: 0.6rem 1rem;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    margin-bottom: 2px;
}

.vanguard-dropdown-item:last-child {
    margin-bottom: 0;
}

.vanguard-dropdown-item:hover {
    background: var(--bg-input);
    color: var(--text-main);
    padding-left: 1.25rem;
}

.vanguard-dropdown-item.active {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary), transparent 90%); 
}

/* =========================================
   PEDIDOS MOBILE CARDS STYLING
   ========================================= */

.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 1.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.order-card:hover {
    border-color: var(--primary);
}

.order-card.expanded {
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.order-card-client {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.order-card-avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary), transparent 80%), color-mix(in srgb, var(--primary), transparent 95%));
    color: var(--primary);
    font-weight: 900;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.02);
}

.order-card-info {
    display: flex;
    flex-direction: column;
}

.order-card-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
}

.order-card-date-wrapper {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.15rem;
}

.order-card-date {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.order-card-amount-wrapper {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-card-amount {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--primary);
}

.order-card-chevron {
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.order-card.expanded .order-card-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

/* Transición fluida utilizando grid rows */
.order-card-detail {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.order-card.expanded .order-card-detail {
    grid-template-rows: 1fr;
}

.order-card-detail-inner {
    overflow: hidden;
}

.order-card-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

.order-card-details-grid {
    display: grid;
    grid-template-cols: 1fr;
    gap: 1rem;
}

.order-card-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-card-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.order-card-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.order-card-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.order-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.order-card-item-qty {
    background: color-mix(in srgb, var(--primary), transparent 90%);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    margin-right: 0.5rem;
}

.order-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* --- UTILITIES & LAYOUT FOR PEDIDOS REDESIGN --- */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.order-card-section {
    display: flex;
    flex-direction: column;
}

.order-card-section-title {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
    opacity: 0.85;
}

.order-card-section-box {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-top: 0.5rem;
}

/* Acciones en hover del comprobante */
.group\/receipt:hover .group-hover\/receipt\:opacity-100 {
    opacity: 1;
}

/* Barra Sticky Inferior de Acciones Móvil */
#orders-mobile-action-bar {
    border-top-left-radius: 2rem;
    border-top-right-radius: 2rem;
    box-shadow: 0 -15px 30px -5px rgba(0, 0, 0, 0.5);
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#orders-mobile-action-bar.translate-y-full {
    transform: translateY(100%);
}

#orders-mobile-action-bar.translate-y-0 {
    transform: translateY(0);
}
