/* 
  Global Dark Mode Styles
  This uses CSS filter invert to automatically map light mode colors to dark mode.
*/

html.dark-mode {
    filter: invert(1) hue-rotate(180deg) brightness(1.05) contrast(1.05);
    background-color: #e0e0e0;
}

/* Re-invert images and videos so they look normal */
html.dark-mode img,
html.dark-mode video,
html.dark-mode iframe,
html.dark-mode .preserve-colors,
html.dark-mode canvas,
html.dark-mode .canvas-container {
    filter: invert(1) hue-rotate(180deg);
}

/* Adjust body to invert into a very deep navy blue (from Slate 100) */
html.dark-mode body {
    background-color: #f1f5f9; 
}

/* Make course cards and all other cards more distinct in dark mode */
html.dark-mode .card,
html.dark-mode .action-card,
html.dark-mode .stat-card,
html.dark-mode .info-card,
html.dark-mode .shop-card,
html.dark-mode .course-card,
html.dark-mode .item-card,
html.dark-mode .company-card,
html.dark-mode .package-card,
html.dark-mode .schedule-card,
html.dark-mode .settings-card,
html.dark-mode .message-card,
html.dark-mode .modal-card,
html.dark-mode .glass-card,
html.dark-mode .upload-card,
html.dark-mode .materials-card {
    background-color: #e2e8f0 !important; /* Inverts to a slightly lighter navy blue */
    border: 1px solid #cbd5e1 !important; /* Subtle dark border */
    box-shadow: none !important;
}

/* Floating / Pill Toggle Button */
.global-theme-toggle {
    background-color: #ececec;
    border-radius: 30px;
    width: 115px !important;
    height: 34px !important;
    display: inline-flex !important;
    align-items: center;
    position: relative;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 999999;
    transition: background-color 0.4s ease;
    padding: 0 5px;
    text-decoration: none;
}

.theme-text-day {
    color: #111;
    font-size: 8.5px;
    font-weight: 700;
    position: absolute;
    left: 8px;
    transition: opacity 0.4s ease;
    letter-spacing: 0.2px;
}

.theme-text-night {
    color: #fff;
    font-size: 8.5px;
    font-weight: 700;
    position: absolute;
    right: 6px;
    opacity: 0;
    transition: opacity 0.4s ease;
    letter-spacing: 0.2px;
}

.theme-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #fff;
    position: absolute;
    right: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}

.theme-circle i {
    color: #111;
    font-size: 14px;
}

.theme-circle .icon-moon {
    display: none;
}

/* Dark Mode State */
html.dark-mode .global-theme-toggle {
    background-color: #000000;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

html.dark-mode .theme-text-day {
    opacity: 0;
}

html.dark-mode .theme-text-night {
    opacity: 1;
}

html.dark-mode .theme-circle {
    transform: translateX(-81px); /* 115 - 28 - 3 - 3 = 81px */
}

html.dark-mode .theme-circle .icon-sun {
    display: none;
}
html.dark-mode .theme-circle .icon-moon {
    display: block;
}

.global-theme-toggle:not(.inline-theme-toggle) {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
}

.inline-theme-toggle {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    margin: 0 10px !important;
}

