/* =================================================================
   DARK MODE TOGGLE - Bottom Left Position
   ================================================================= */

.dark-mode-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 50px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    user-select: none;
}

.dark-mode-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.dark-mode-toggle:active {
    transform: translateY(0);
    transition: transform 0.1s ease;
}

/* Icon container */
.dark-mode-toggle .toggle-icon {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sun and Moon icons */
.dark-mode-toggle .sun-icon,
.dark-mode-toggle .moon-icon {
    position: absolute;
    font-size: 18px;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle .sun-icon {
    color: #f59e0b;
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.dark-mode-toggle .moon-icon {
    color: #64748b;
    opacity: 0;
    transform: rotate(180deg) scale(0.5);
}

/* Dark mode state */
body.dark-mode .dark-mode-toggle {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .dark-mode-toggle:hover {
    border-color: #7c8fec;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .dark-mode-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
}

body.dark-mode .dark-mode-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: #7c8fec;
}

/* Accessibility */
.dark-mode-toggle:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.dark-mode-toggle:focus:not(:focus-visible) {
    outline: none;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .dark-mode-toggle {
        bottom: 80px; /* Move up to avoid potential mobile UI conflicts */
        left: 15px;
        width: 45px;
        height: 45px;
    }
    
    .dark-mode-toggle .toggle-icon {
        width: 20px;
        height: 20px;
    }
    
    .dark-mode-toggle .sun-icon,
    .dark-mode-toggle .moon-icon {
        font-size: 16px;
    }
}

/* Animation for smooth theme transition */
*, *::before, *::after {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Ensure toggle doesn't interfere with other fixed elements */
.dark-mode-toggle {
    pointer-events: auto;
}

/* Loading state */
.dark-mode-toggle.loading {
    pointer-events: none;
    opacity: 0.7;
}

.dark-mode-toggle.loading .toggle-icon {
    animation: spin 0.6s ease-in-out;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}