/* Dark mode variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --accent-color: #6366F1;
    --accent-hover: #4F46E5;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --header-bg: #ffffff;
    --modal-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --success-color: #10B981;
    --error-color: #EF4444;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --card-bg: #1e293b;
    --accent-color: #818CF8;
    --accent-hover: #6366F1;
    --input-bg: #0f172a;
    --input-border: #334155;
    --header-bg: #1e293b;
    --modal-bg: #1e293b;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --success-color: #34D399;
    --error-color: #F87171;
}

/* Aplicar variables */
body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

nav {
    background-color: var(--header-bg) !important;
    border-bottom: 1px solid var(--border-color);
}

.task-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px var(--shadow-color);
}

/* Modales */
#userModal {
    z-index: 60;
}

#usersView {
    z-index: 50;
}

.modal-content {
    background-color: var(--modal-bg) !important;
    border: 1px solid var(--border-color);
}

/* Sound switch */
.sound-switch {
    position: relative;
    width: 60px;
    height: 30px;
    margin: 0 10px;
}

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

.sound-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: .4s;
    border-radius: 30px;
    overflow: hidden;
}

.sound-slider:before {
    position: absolute;
    content: "\f6a9"; /* Font Awesome muted icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 2px;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
    color: var(--text-secondary);
    font-size: 12px;
}

input:checked + .sound-slider:before {
    content: "\f028"; /* Font Awesome volume icon */
    transform: translateX(30px);
    color: var(--accent-color);
}

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

/* Dark mode switch mejorado */
.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: .4s;
    border-radius: 30px;
    overflow: hidden;
}

.slider:before {
    position: absolute;
    content: "☀️";
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 2px;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}

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

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

/* Mejoras estéticas generales */
.task-card {
    backdrop-filter: blur(10px);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow-color);
    background-color: color-mix(in srgb, var(--card-bg) 85%, var(--accent-color));
}

.task-list-item {
    transition: all 0.3s ease;
}

.task-list-item:hover {
    box-shadow: 0 8px 16px var(--shadow-color);
    background-color: color-mix(in srgb, var(--card-bg) 85%, var(--accent-color));
}

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

/* Inputs y selects mejorados */
input, select, textarea {
    background-color: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--text-primary) !important;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Estados y prioridades */
.status-badge {
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.priority-badge {
    padding: 0.35rem 1rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

[data-theme="dark"] .priority-baja {
    background-color: rgba(16, 185, 129, 0.2);
    color: #34D399;
}

[data-theme="dark"] .priority-media {
    background-color: rgba(245, 158, 11, 0.2);
    color: #FBBF24;
}

[data-theme="dark"] .priority-alta {
    background-color: rgba(239, 68, 68, 0.2);
    color: #F87171;
}

/* Rotate settings icon when menu is open */
#settingsBtn i {
    transition: transform 0.3s ease;
    color: var(--text-primary);
}

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

/* Settings menu */
#settingsMenu {
    z-index: 1000;
}

/* Settings menu items hover effect */
#settingsMenu a,
#settingsMenu button {
    position: relative;
    transition: all 0.2s ease;
}

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

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 50;
    animation: notificationIn 0.3s ease-out forwards;
}

@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;
}

/* Fixed Pagination */
#tasksPagination {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    border-top: 1px solid var(--border-color);
    background-color: var(--card-bg);
    box-shadow: 0 -4px 6px var(--shadow-color);
}

/* Add padding to main content to prevent overlap with fixed pagination */
#tasksGrid,
#tasksList {
    padding-bottom: 80px; /* Height of pagination + some extra space */
}

/* 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;
    }
}
