Turkcell / frontend /src /ThemeToggle.css
huseyinemretech's picture
Lite Deploy: Clean start without large files
9f48b33
Raw
History Blame Contribute Delete
3.87 kB
/* Theme Toggle Styles */
.theme-toggle {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
background: none;
border: none;
cursor: pointer;
padding: 0;
outline: none;
}
.toggle-track {
width: 70px;
height: 36px;
border-radius: 18px;
position: relative;
overflow: hidden;
transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
box-shadow:
0 4px 20px rgba(0, 0, 0, 0.2),
inset 0 -2px 10px rgba(0, 0, 0, 0.1),
inset 0 2px 10px rgba(255, 255, 255, 0.2);
}
/* Light mode track (sky blue gradient) */
.theme-toggle.light .toggle-track {
background: linear-gradient(180deg, #87CEEB 0%, #4FC3F7 50%, #81D4FA 100%);
border: 2px solid rgba(255, 255, 255, 0.4);
}
/* Dark mode track (night sky gradient) */
.theme-toggle.dark .toggle-track {
background: linear-gradient(180deg, #1a237e 0%, #0a0e35 50%, #121858 100%);
border: 2px solid rgba(255, 193, 7, 0.3);
}
.toggle-thumb {
position: absolute;
width: 28px;
height: 28px;
border-radius: 50%;
top: 4px;
z-index: 10;
/* Thumb always on top */
transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
display: flex;
align-items: center;
justify-content: center;
box-shadow:
0 2px 10px rgba(0, 0, 0, 0.3),
0 0 20px rgba(255, 193, 7, 0.2);
}
/* Light mode thumb (sun) */
.theme-toggle.light .toggle-thumb {
left: 4px;
background: linear-gradient(135deg, #FFF9C4 0%, #FFD54F 50%, #FFC107 100%);
box-shadow:
0 0 20px rgba(255, 193, 7, 0.6),
0 0 40px rgba(255, 193, 7, 0.3),
inset 0 -2px 5px rgba(255, 152, 0, 0.3);
}
/* Dark mode thumb (moon) */
.theme-toggle.dark .toggle-thumb {
left: 38px;
background: linear-gradient(135deg, #E8EAF6 0%, #C5CAE9 50%, #9FA8DA 100%);
box-shadow:
0 0 15px rgba(197, 202, 233, 0.5),
0 0 30px rgba(159, 168, 218, 0.3);
}
.toggle-icon {
font-size: 14px;
transition: all 0.4s ease;
}
.theme-toggle.light .toggle-icon {
color: #FF8F00;
}
.theme-toggle.dark .toggle-icon {
color: #5C6BC0;
}
/* Stars animation for dark mode */
.toggle-stars {
position: absolute;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 5;
/* Stars behind thumb */
}
.star {
position: absolute;
color: #FFF9C4;
font-size: 8px;
opacity: 0;
animation: twinkle 1.5s infinite;
}
.theme-toggle.dark .star {
opacity: 1;
}
.star-1 {
top: 8px;
left: 10px;
/* Moved to left side */
animation-delay: 0s;
}
.star-2 {
top: 20px;
left: 18px;
/* Moved to left side */
animation-delay: 0.5s;
font-size: 6px;
}
.star-3 {
top: 12px;
left: 28px;
/* Moved to left side */
animation-delay: 1s;
font-size: 10px;
}
@keyframes twinkle {
0%,
100% {
opacity: 0.3;
transform: scale(1);
}
50% {
opacity: 1;
transform: scale(1.2);
}
}
/* Clouds animation for light mode */
.toggle-clouds {
position: absolute;
width: 100%;
height: 100%;
pointer-events: none;
}
.cloud {
position: absolute;
color: rgba(255, 255, 255, 0.8);
font-size: 12px;
opacity: 0;
transition: opacity 0.3s ease;
}
.theme-toggle.light .cloud {
opacity: 1;
animation: float-cloud 3s infinite ease-in-out;
}
.cloud-1 {
top: 4px;
right: 8px;
animation-delay: 0s;
}
.cloud-2 {
top: 16px;
right: 16px;
font-size: 10px;
animation-delay: 1.5s;
}
@keyframes float-cloud {
0%,
100% {
transform: translateX(0);
}
50% {
transform: translateX(3px);
}
}
/* Hover effect */
.theme-toggle:hover .toggle-track {
transform: scale(1.05);
box-shadow:
0 6px 25px rgba(0, 0, 0, 0.3),
inset 0 -2px 10px rgba(0, 0, 0, 0.1),
inset 0 2px 10px rgba(255, 255, 255, 0.2);
}
.theme-toggle:hover .toggle-thumb {
transform: scale(1.1);
}
/* Focus state for accessibility */
.theme-toggle:focus-visible .toggle-track {
outline: 3px solid var(--turkcell-yellow);
outline-offset: 3px;
}