/* Color system and variables */
:root {
    /* Base colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --card-accent-bg: #f8fafc;
    --banner-bg: #f3f4f6;
    
    /* Interactive colors */
    --accent-color: #6366F1;
    --accent-hover: #4F46E5;
    --accent-light: #EEF2FF;
    --accent-active: #4338CA;
    
    /* Form elements */
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --input-focus-shadow: rgba(99, 102, 241, 0.15);
    
    /* UI elements */
    --header-bg: #ffffff;
    --modal-bg: #ffffff;
    --shadow-color: rgba(15, 23, 42, 0.06);
    --shadow-color-hover: rgba(15, 23, 42, 0.1);
    
    /* Feedback colors */
    --success-color: #10B981;
    --success-light: #D1FAE5;
    --warning-color: #F59E0B;
    --warning-light: #FEF3C7;
    --error-color: #EF4444;
    --error-light: #FEE2E2;
    --info-color: #3B82F6;
    --info-light: #DBEAFE;
    
    /* Status colors */
    --status-pending-bg: #FEF3C7;
    --status-pending-text: #92400E;
    --status-preparing-bg: #DBEAFE;
    --status-preparing-text: #1E40AF;
    --status-delivering-bg: #F3E8FF;
    --status-delivering-text: #6D28D9;
    --status-delivered-bg: #D1FAE5;
    --status-delivered-text: #065F46;
    
    /* Elevation - shadows */
    --shadow-sm: 0 1px 2px 0 var(--shadow-color);
    --shadow-md: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -2px var(--shadow-color);
    --shadow-lg: 0 10px 15px -3px var(--shadow-color), 0 4px 6px -4px var(--shadow-color);
    --shadow-hover: 0 10px 25px -5px var(--shadow-color-hover), 0 8px 10px -6px var(--shadow-color-hover);
    
    /* Animation */
    --transition-fast: 150ms;
    --transition-normal: 250ms;
    --transition-slow: 350ms;
}

[data-theme="dark"] {
    /* Base colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --card-bg: #293548;
    --card-accent-bg: #1e293b;
    --panel-bg: #2d3748;
    --banner-bg: #242f42;
    --button-bg: #3a4659;
    --button-text: #e2e8f0;
    --status-label-bg: #374151;
    --item-text: #cbd5e1;
    
    /* Interactive colors */
    --accent-color: #818CF8;
    --accent-hover: #6366F1;
    --accent-light: #1e293b;
    --accent-active: #818CF8;
    
    /* Form elements */
    --input-bg: #0f172a;
    --input-border: #334155;
    --input-focus-shadow: rgba(99, 102, 241, 0.25);
    
    /* UI elements */
    --header-bg: #1e293b;
    --modal-bg: #1e293b;
    --shadow-color: rgba(0, 0, 0, 0.25);
    --shadow-color-hover: rgba(0, 0, 0, 0.4);
    
    /* Feedback colors */
    --success-color: #34D399;
    --success-light: rgba(52, 211, 153, 0.2);
    --warning-color: #FBBF24;
    --warning-light: rgba(251, 191, 36, 0.2);
    --error-color: #F87171;
    --error-light: rgba(248, 113, 113, 0.2);
    --info-color: #60A5FA;
    --info-light: rgba(96, 165, 250, 0.2);
    
/* Status colors */
--status-pending-bg: rgba(251, 191, 36, 0.2);
--status-pending-text: #FBBF24;
--status-pending-border: rgba(251, 191, 36, 0.4);
--status-preparing-bg: rgba(96, 165, 250, 0.2);
--status-preparing-text: #60A5FA;
--status-preparing-border: rgba(96, 165, 250, 0.4);
--status-delivering-bg: rgba(167, 139, 250, 0.2);
--status-delivering-text: #A78BFA;
--status-delivering-border: rgba(167, 139, 250, 0.4);
--status-delivered-bg: rgba(52, 211, 153, 0.2);
--status-delivered-text: #34D399;
--status-delivered-border: rgba(52, 211, 153, 0.4);
    
    /* Elevation - shadows - darker in dark mode */
    --shadow-sm: 0 1px 3px 0 var(--shadow-color);
    --shadow-md: 0 4px 8px -1px var(--shadow-color), 0 2px 6px -2px var(--shadow-color);
    --shadow-lg: 0 12px 20px -3px var(--shadow-color), 0 4px 8px -4px var(--shadow-color);
    --shadow-hover: 0 14px 30px -5px var(--shadow-color-hover), 0 10px 15px -6px var(--shadow-color-hover);
}

/* Base styles */
body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: background-color var(--transition-normal) ease, 
                color var(--transition-normal) ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

/* Typography enhancements */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.25;
    margin-bottom: 0.5em;
}

p {
    margin-bottom: 1em;
}

/* Layout elements */
nav {
    background-color: var(--header-bg) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(8px);
}

/* Navigation buttons in dark mode */
.dark button.bg-white {
    background-color: var(--button-bg) !important;
    color: var(--button-text) !important;
}

/* Fix status badge in dark mode to prevent wrapping */
.dark [class*="En preparación"] {
    white-space: nowrap !important;
}

/* Improve text visibility for menu items in dark mode */
.dark .order-item-name,
.dark .order-item-price {
    color: var(--item-text) !important;
}

.task-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal) ease;
    box-shadow: var(--shadow-md);
    border-radius: 0.75rem;
}

/* Card hover effects - more subtle for a professional look */
.task-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: var(--accent-color);
    transition: all var(--transition-fast) ease;
}

/* Detailed view styles with enhanced visual hierarchy */
.detalle-view {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.detalle-view > div {
    margin-bottom: 1rem !important;
    width: 100% !important;
    display: flex;
    flex-direction: column;
    border-radius: 0.75rem !important;
    overflow: hidden;
}

.detalle-view .flex.items-center.justify-between {
    flex: 1;
}

.detalle-view .bg-gray-900 {
    width: 100% !important;
    background-color: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
}

.detalle-view .flex.items-center.justify-between {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
}

.detalle-view .bg-gray-800 {
    background-color: var(--accent-light) !important;
}

.detalle-view .text-indigo-400 {
    color: var(--accent-color) !important;
    font-weight: 600;
}

.detalle-view .text-gray-300,
.detalle-view .text-gray-400 {
    color: var(--text-secondary) !important;
}

/* Status badges in list view */
.detalle-view .bg-blue-100 {
    background-color: var(--status-preparing-bg) !important;
    border-radius: 0.5rem !important;
    padding: 0.375rem 0.75rem !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
}

.detalle-view .text-blue-800 {
    color: var(--status-preparing-text) !important;
}

/* Button enhancements */
.detalle-view button {
    padding: 0.625rem 1.25rem !important;
    transition: all var(--transition-fast) ease-in-out !important;
    border-radius: 0.5rem !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    box-shadow: var(--shadow-sm) !important;
}

.detalle-view button:hover {
    transform: translateY(-1px) !important;
    box-shadow: var(--shadow-md) !important;
}

.detalle-view button:active {
    transform: translateY(0) !important;
}

.detalle-view .rounded {
    border-radius: 0.75rem !important;
}

.detalle-view .shadow-md {
    box-shadow: var(--shadow-md) !important;
}

.detalle-view .hover\:shadow-lg:hover {
    box-shadow: var(--shadow-hover) !important;
}

/* Modal enhancements */
#userModal, #orderModal, #categoryModal, #itemModal {
    z-index: 60;
}

#usersView {
    z-index: 50;
}

.modal-content {
    background-color: var(--modal-bg) !important;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Dark mode switch with enhanced UI */
.theme-switch {
    position: relative;
    width: 60px;
    height: 30px;
    margin: 0 10px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    transition: all var(--transition-normal) ease;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.slider:before {
    position: absolute;
    content: "☀️";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 2px;
    transition: all var(--transition-normal) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 50%;
    z-index: 2;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
}

input:checked + .slider:before {
    content: "🌙";
    transform: translateX(30px);
}

input:checked + .slider {
    background-color: var(--bg-primary);
}

/* Card design enhancements */
.task-card, .order-card {
    backdrop-filter: blur(10px);
    border-radius: 0.75rem;
    transition: all var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.task-card:hover, .order-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-color);
}

.task-list-item {
    transition: all var(--transition-normal) ease;
    border-radius: 0.5rem;
    border-left: 3px solid transparent;
}

.task-list-item:hover {
    box-shadow: var(--shadow-md);
    background-color: var(--accent-light);
    border-left-color: var(--accent-color);
}

.task-list-item .truncate {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status indicators */
.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.status-pending {
    background-color: var(--status-pending-bg);
    color: var(--status-pending-text);
}

.status-preparing {
    background-color: var(--status-preparing-bg);
    color: var(--status-preparing-text);
}

.status-delivering {
    background-color: var(--status-delivering-bg);
    color: var(--status-delivering-text);
}

.status-delivered {
    background-color: var(--status-delivered-bg);
    color: var(--status-delivered-text);
}

/* Form element enhancements */
input, select, textarea {
    background-color: var(--input-bg) !important;
    border: 1px solid var(--input-border) !important;
    color: var(--text-primary) !important;
    transition: all var(--transition-fast) ease;
    border-radius: 0.5rem !important;
    padding: 0.625rem 0.75rem !important;
    font-size: 0.9375rem !important;
    line-height: 1.5 !important;
    width: 100% !important;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px var(--input-focus-shadow) !important;
    outline: none !important;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem !important;
}

label {
    font-weight: 500;
    margin-bottom: 0.375rem;
    display: block;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Custom form group spacing */
.form-group {
    margin-bottom: 1.25rem;
}

/* Enhanced status badges and priority indicators */
.status-badge {
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.015em;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.status-badge i {
    font-size: 0.75rem;
}

.priority-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.025em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.priority-baja {
    background-color: var(--success-light);
    color: var(--success-color);
}

.priority-media {
    background-color: var(--warning-light);
    color: var(--warning-color);
}

.priority-alta {
    background-color: var(--error-light);
    color: var(--error-color);
}

/* Enhanced UI for settings and menus */
#settingsBtn i {
    transition: transform var(--transition-normal) ease;
    color: var(--text-primary);
}

#settingsBtn.active i {
    transform: rotate(180deg);
}

/* Settings menu with improved design */
#settingsMenu {
    z-index: 1000;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Settings menu items with better hover effects */
#settingsMenu a,
#settingsMenu button {
    position: relative;
    transition: all var(--transition-fast) ease;
    padding: 0.75rem 1rem !important;
    font-weight: 500;
}

#settingsMenu a:hover, 
#settingsMenu button:hover {
    background-color: var(--accent-light);
}

#settingsMenu a:hover::before, 
#settingsMenu button:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--accent-color);
}

#settingsMenu a i,
#settingsMenu button i {
    margin-right: 0.5rem;
    width: 1.25rem;
    text-align: center;
}

/* Enhanced toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    animation: notificationIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@keyframes notificationIn {
    from {
        transform: translateX(100%) translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

.toast-success {
    background: var(--success-color);
}

.toast-error {
    background: var(--error-color);
}

/* New task notification */
.new-task-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    background: var(--accent-color);
    color: white;
    font-weight: 500;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
}

.new-task-notification.show {
    transform: translateX(0);
    opacity: 1;
}

/* Task animations */
@keyframes taskHighlight {
    0% {
        background-color: var(--accent-color);
        transform: scale(1) translateX(0);
        box-shadow: 0 0 20px var(--accent-color);
    }
    25% {
        background-color: rgba(99, 102, 241, 0.2);
        transform: scale(1.03) translateX(-2px);
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
    }
    50% {
        background-color: rgba(99, 102, 241, 0.1);
        transform: scale(1.02) translateX(2px);
        box-shadow: 0 0 25px rgba(99, 102, 241, 0.3);
    }
    75% {
        background-color: rgba(99, 102, 241, 0.05);
        transform: scale(1.01) translateX(-1px);
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    }
    100% {
        background-color: var(--card-bg);
        transform: scale(1) translateX(0);
        box-shadow: 0 4px 6px var(--shadow-color);
    }
}

@keyframes newTaskSlide {
    0% {
        transform: translateX(-30px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.task-highlight {
    animation: taskHighlight 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.task-new {
    animation: 
        newTaskSlide 0.5s ease-out forwards,
        taskHighlight 2s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}

/* Responsive */
@media (max-width: 640px) {
    .task-card {
        margin-bottom: 1rem;
    }

    .toast,
    .new-task-notification {
        width: 90%;
        left: 5%;
        right: 5%;
    }

    .toast {
        bottom: 10px;
    }

    .new-task-notification {
        top: 10px;
    }

    #settingsMenu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        border-radius: 1rem 1rem 0 0;
        transform-origin: bottom center;
    }

    #settingsMenu.show {
        animation: settingsMenuMobileIn 0.3s ease-out forwards;
    }

    @keyframes settingsMenuMobileIn {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
}

/* Estilos para el modal de imagen */
#imagePreviewModal {
    transition: opacity 0.3s ease;
}

#imagePreviewModal:not(.hidden) {
    animation: modalFadeIn 0.3s ease forwards;
}

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

#modalImage {
    transition: transform 0.3s ease;
    transform-origin: center;
    will-change: transform;
}

#modalImage.dragging {
    cursor: grabbing;
}

#zoomIn, #zoomOut {
    transition: all 0.2s ease;
}

#zoomIn:hover, #zoomOut:hover {
    background-color: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

#closeImagePreview {
    transition: all 0.2s ease;
}

#closeImagePreview:hover {
    transform: scale(1.1) rotate(90deg);
}

/* Responsive para el modal de imagen */
@media (max-width: 640px) {
    #modalImage {
        max-width: 95vw;
        max-height: 80vh;
    }

    #zoomIn, #zoomOut {
        width: 40px;
        height: 40px;
    }
}
