/**
 * Frontend Styles for Dark Mode Plugin
 */

/* Dark Mode Base Styles */
[data-theme="dark"],
.dark-mode {
    color-scheme: dark;
}

[data-theme="dark"] body,
[data-theme="dark"] .site-content,
[data-theme="dark"] .content,
.dark-mode body,
.dark-mode .site-content,
.dark-mode .content {
    background-color: var(--dm-background);
    color: var(--dm-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Links */
[data-theme="dark"] a,
.dark-mode a {
    color: var(--dm-link);
    transition: color 0.2s ease;
}

[data-theme="dark"] a:hover,
.dark-mode a:hover {
    color: var(--dm-link-hover);
}

/* Inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select,
.dark-mode input[type="text"],
.dark-mode input[type="email"],
.dark-mode input[type="password"],
.dark-mode input[type="search"],
.dark-mode input[type="url"],
.dark-mode input[type="tel"],
.dark-mode input[type="number"],
.dark-mode textarea,
.dark-mode select {
    background-color: var(--dm-input-bg);
    color: var(--dm-input-text);
    border-color: var(--dm-input-border);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
.dark-mode input::placeholder,
.dark-mode textarea::placeholder {
    color: var(--dm-input-placeholder);
}

/* Buttons */
[data-theme="dark"] button,
[data-theme="dark"] input[type="submit"],
[data-theme="dark"] input[type="button"],
[data-theme="dark"] .button,
[data-theme="dark"] .btn,
.dark-mode button,
.dark-mode input[type="submit"],
.dark-mode input[type="button"],
.dark-mode .button,
.dark-mode .btn {
    background-color: var(--dm-button-bg);
    color: var(--dm-button-text);
    border-color: var(--dm-button-border);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

[data-theme="dark"] button:hover,
[data-theme="dark"] input[type="submit"]:hover,
[data-theme="dark"] input[type="button"]:hover,
[data-theme="dark"] .button:hover,
[data-theme="dark"] .btn:hover,
.dark-mode button:hover,
.dark-mode input[type="submit"]:hover,
.dark-mode input[type="button"]:hover,
.dark-mode .button:hover,
.dark-mode .btn:hover {
    background-color: var(--dm-button-hover-bg);
    color: var(--dm-button-hover-text);
}

/* Floating Switch */
.dm-floating-switch {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
}

.dm-floating-switch:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.dm-floating-switch:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

.dm-floating-switch:active {
    transform: scale(0.95);
}

/* Dark mode switch colors */
[data-theme="dark"] .dm-floating-switch,
.dark-mode .dm-floating-switch {
    background-color: #1a1625;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .dm-floating-switch:hover,
.dark-mode .dm-floating-switch:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 3px 6px rgba(0, 0, 0, 0.25);
}

/* Switch Icons */
.dm-floating-switch .dm-icon {
    position: absolute;
    width: 24px;
    height: 24px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    color: #1a1625;
}

[data-theme="dark"] .dm-floating-switch .dm-icon,
.dark-mode .dm-floating-switch .dm-icon {
    color: #e8e6ed;
}

.dm-floating-switch .dm-icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

.dm-floating-switch .dm-icon-moon {
    opacity: 0;
    transform: rotate(180deg);
}

[data-theme="dark"] .dm-floating-switch .dm-icon-sun,
.dark-mode .dm-floating-switch .dm-icon-sun {
    opacity: 0;
    transform: rotate(-180deg);
}

[data-theme="dark"] .dm-floating-switch .dm-icon-moon,
.dark-mode .dm-floating-switch .dm-icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Device Visibility */
@media (min-width: 1024px) {
    .dm-floating-switch:not([data-visible-on*="desktop"]) {
        display: none !important;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .dm-floating-switch:not([data-visible-on*="tablet"]) {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .dm-floating-switch:not([data-visible-on*="mobile"]) {
        display: none !important;
    }

    .dm-floating-switch {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }

    .dm-floating-switch .dm-icon {
        width: 20px;
        height: 20px;
    }
}

/* Smooth transitions for all dark mode elements */
[data-theme="dark"] *,
.dark-mode * {
    transition-property: background-color, color, border-color;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

/* Prevent transition on images */
[data-theme="dark"] img,
[data-theme="dark"] video,
.dark-mode img,
.dark-mode video {
    transition: none;
}

/* Typography adjustments */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode h5,
.dark-mode h6 {
    color: var(--dm-text);
}

/* Prevent FOUC */
html:not([data-theme]) body {
    opacity: 1;
}