/* --- Core Aesthetic --- */
body {
    background: linear-gradient(135deg, #fafaf9 0%, #f3f4f6 100%);
    min-height: 100vh;
    color: #1c1917;
    padding-bottom: 100px;
}

/* Dark Mode Override */
.dark body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f8fafc;
}

/* Ambient Lights */
.ambient-light {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
}

.light-1 {
    top: -15%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.25) 0%, transparent 70%);
}

.light-2 {
    bottom: -15%;
    right: -10%;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
}

/* Glassmorphism Utilities */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.dark .glass {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Card Styling --- */
.glass-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.dark .glass-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.glass-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}

/* --- Edit Mode Button Transitions (TOGGLE ONLY) --- */
.card-actions {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

/* Only show when Edit Mode is ON */
body.edit-mode .card-actions {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}


/* --- Search Bar & Header --- */
@keyframes gradient-flow {
    0% {
        background: linear-gradient(90deg, transparent 0%, rgba(96, 165, 250, 0.3) 25%, rgba(167, 139, 250, 0.3) 50%, rgba(248, 113, 113, 0.3) 75%, transparent 100%);
        background-position: 200% 0;
    }

    50% {
        background: linear-gradient(90deg, transparent 0%, rgba(248, 113, 113, 0.3) 25%, rgba(96, 165, 250, 0.3) 50%, rgba(167, 139, 250, 0.3) 75%, transparent 100%);
        background-position: -200% 0;
    }

    100% {
        background: linear-gradient(90deg, transparent 0%, rgba(167, 139, 250, 0.3) 25%, rgba(248, 113, 113, 0.3) 50%, rgba(96, 165, 250, 0.3) 75%, transparent 100%);
        background-position: 200% 0;
    }
}

@keyframes border-glow {
    0% {
        box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2), 0 0 15px rgba(96, 165, 250, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.5);
    }

    33% {
        box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.2), 0 0 15px rgba(167, 139, 250, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.5);
    }

    66% {
        box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.2), 0 0 15px rgba(248, 113, 113, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.5);
    }

    100% {
        box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2), 0 0 15px rgba(96, 165, 250, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.5);
    }
}

@keyframes icon-glow {
    0% {
        filter: drop-shadow(0 0 2px rgba(96, 165, 250, 0.6));
        color: rgba(96, 165, 250, 0.9);
    }

    33% {
        filter: drop-shadow(0 0 2px rgba(167, 139, 250, 0.6));
        color: rgba(167, 139, 250, 0.9);
    }

    66% {
        filter: drop-shadow(0 0 2px rgba(248, 113, 113, 0.6));
        color: rgba(248, 113, 113, 0.9);
    }

    100% {
        filter: drop-shadow(0 0 2px rgba(96, 165, 250, 0.6));
        color: rgba(96, 165, 250, 0.9);
    }
}

.animate-gradient-flow {
    animation: gradient-flow 10s linear infinite;
    background-size: 300% 100%;
}

.animate-border-glow {
    animation: border-glow 8s ease-in-out infinite;
}

.animate-icon-glow {
    animation: icon-glow 8s ease-in-out infinite;
}

/* --- FIX FOR DOUBLE BORDER --- */
#searchInput {
    caret-color: #8b5cf6;
}

#searchInput:focus {
    background-color: rgba(255, 255, 255, 0.4);
    outline: none !important;
    box-shadow: none !important;
}

#searchInput:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* Glass Dropdown with Smooth Transition */
.glass-dropdown-menu {
    background: rgb(255, 255, 255);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    transform-origin: top right;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .glass-dropdown-menu {
    background: rgb(30, 41, 59);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dropdown-hidden {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.dropdown-visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(156, 163, 175, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    transition: .3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked+.toggle-slider {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
}

input:checked+.toggle-slider:before {
    transform: translateX(20px);
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.4);
}

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
}

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

    100% {
        background-position: -200% 0;
    }
}

/* Loader */
.loader {
    --color-one: #ffbf48;
    --color-two: #be4a1d;
    --color-three: #ffbf4780;
    --color-four: #bf4a1d80;
    --color-five: #ffbf4740;
    --time-animation: 2s;
    --size: 1;
    position: relative;
    border-radius: 50%;
    transform: scale(var(--size));
    box-shadow: 0 0 25px 0 var(--color-three), 0 20px 50px 0 var(--color-four);
    animation: colorize calc(var(--time-animation) * 3) ease-in-out infinite;
    margin: 0 auto;
}

.loader::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border-top: solid 1px var(--color-one);
    border-bottom: solid 1px var(--color-two);
    background: linear-gradient(180deg, var(--color-five), var(--color-four));
    box-shadow: inset 0 10px 10px 0 var(--color-three), inset 0 -10px 10px 0 var(--color-four);
}

.loader .box {
    width: 100px;
    height: 100px;
    background: linear-gradient(180deg, var(--color-one) 30%, var(--color-two) 70%);
    mask: url(#clipping);
    -webkit-mask: url(#clipping);
}

.loader svg {
    position: absolute;
}

.loader svg #clipping {
    filter: contrast(15);
    animation: roundness calc(var(--time-animation) / 2) linear infinite;
}

.loader svg #clipping polygon {
    filter: blur(7px);
}

.loader svg #clipping polygon:nth-child(1) {
    transform-origin: 75% 25%;
    transform: rotate(90deg);
}

.loader svg #clipping polygon:nth-child(2) {
    transform-origin: 50% 50%;
    animation: rotation var(--time-animation) linear infinite reverse;
}

.loader svg #clipping polygon:nth-child(3) {
    transform-origin: 50% 60%;
    animation: rotation var(--time-animation) linear infinite;
    animation-delay: calc(var(--time-animation) / -3);
}

.loader svg #clipping polygon:nth-child(4) {
    transform-origin: 40% 40%;
    animation: rotation var(--time-animation) linear infinite reverse;
}

.loader svg #clipping polygon:nth-child(5) {
    transform-origin: 40% 40%;
    animation: rotation var(--time-animation) linear infinite reverse;
    animation-delay: calc(var(--time-animation) / -2);
}

.loader svg #clipping polygon:nth-child(6) {
    transform-origin: 60% 40%;
    animation: rotation var(--time-animation) linear infinite;
}

.loader svg #clipping polygon:nth-child(7) {
    transform-origin: 60% 40%;
    animation: rotation var(--time-animation) linear infinite;
    animation-delay: calc(var(--time-animation) / -1.5);
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

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

@keyframes roundness {
    0% {
        filter: contrast(15);
    }

    20% {
        filter: contrast(3);
    }

    40% {
        filter: contrast(3);
    }

    60% {
        filter: contrast(15);
    }

    100% {
        filter: contrast(15);
    }
}

@keyframes colorize {
    0% {
        filter: hue-rotate(0deg);
    }

    20% {
        filter: hue-rotate(-30deg);
    }

    40% {
        filter: hue-rotate(-60deg);
    }

    60% {
        filter: hue-rotate(-90deg);
    }

    80% {
        filter: hue-rotate(-45deg);
    }

    100% {
        filter: hue-rotate(0deg);
    }
}