/* Dark Mode Styles */

/* Dark mode toggle button */
.dark-mode-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    font-size: 1.4em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Responsive positioning for mobile */
@media (max-width: 1040px) {
    .dark-mode-toggle {
        bottom: 25px;
        right: 25px;
        width: 55px;
        height: 55px;
        font-size: 1.2em;
    }
}

@media (max-width: 540px) {
    .dark-mode-toggle {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.1em;
    }
}

.dark-mode-toggle:hover {
    background: #555;
    transform: scale(1.1);
}

.dark-mode-toggle.dark {
    background: #ffd700;
    color: #333;
}

.dark-mode-toggle.dark:hover {
    background: #ffed4e;
}

.dark-mode-toggle.auto {
    background: linear-gradient(45deg, #4a90e2, #7b68ee);
    color: #fff;
    animation: autoModeGlow 2s ease-in-out infinite alternate;
}

.dark-mode-toggle.auto:hover {
    background: linear-gradient(45deg, #5ba0f2, #8b78fe);
    transform: scale(1.1);
}

@keyframes autoModeGlow {
    0% {
        box-shadow: 0 2px 10px rgba(74, 144, 226, 0.3);
    }
    100% {
        box-shadow: 0 2px 20px rgba(123, 104, 238, 0.6);
    }
}

/* Dark mode root styles */
body.dark-mode {
    background: #121212;
    color: #e0e0e0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Prevent layout shift by ensuring consistent scrollbar space */
html {
    overflow-y: scroll; /* Always show vertical scrollbar space */
}

/* Alternative approach - use scrollbar-gutter for modern browsers */
@supports (scrollbar-gutter: stable) {
    html {
        overflow-y: auto;
        scrollbar-gutter: stable;
    }
}

/* Topbar dark mode */
body.dark-mode .topbar {
    background: #1f1f1f;
}

body.dark-mode .topbar h3 {
    color: #e0e0e0;
}

body.dark-mode .topbar h3 a {
    color: #e0e0e0;
}

/* Header dark mode */
body.dark-mode header {
    background: #121212;
}

body.dark-mode header.fixed {
    box-shadow: 0 0 15px rgba(255,255,255,0.1);
}

/* Navigation dark mode */
body.dark-mode nav ul li a {
    color: #e0e0e0;
}

body.dark-mode nav ul li a::after {
    background: #e0e0e0;
}

/* Mobile menu icons dark mode */
body.dark-mode .menuicons a {
    color: #e0e0e0 !important;
}

body.dark-mode .menuicons a:hover {
    color: #fff !important;
}

body.dark-mode .menuicons a.hidenav {
    color: #fff !important;
}

/* Banner dark mode */
body.dark-mode .banner h2 {
    color: #e0e0e0;
}

/* About section dark mode */
body.dark-mode .about {
    background: #121212;
}

body.dark-mode .about .text {
    color: #e0e0e0;
}

body.dark-mode .about .text h4,
body.dark-mode .about .text h3,
body.dark-mode .about .text h5 {
    color: #e0e0e0;
}

body.dark-mode .about .text p {
    color: #b0b0b0;
}

/* Stats section dark mode */
body.dark-mode .stats {
    background: #1a1a1a;
}

body.dark-mode .stats .item {
    color: #e0e0e0;
    border-bottom: 1px solid #333;
}

/* Services section dark mode */
body.dark-mode .services {
    background: #121212;
}

body.dark-mode .services h2 {
    color: #e0e0e0;
}

body.dark-mode .service_items .item .text {
    background: #1a1a1a;
}

body.dark-mode .service_items .item h3 {
    color: #e0e0e0;
}

body.dark-mode .service_items .item h3:before {
    color: #666;
}

body.dark-mode .service_items .item p {
    color: #b0b0b0;
}

body.dark-mode .service_items .item ul {
    color: #b0b0b0;
}

/* Reviews section dark mode */
body.dark-mode .reviews {
    background: #1a1a1a;
}

body.dark-mode .reviews h2,
body.dark-mode .reviews h3 {
    color: #e0e0e0;
}

body.dark-mode .reviewslider .item .itemcontent .textbox {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.dark-mode .reviewslider .item .itemcontent .textbox:after {
    border-color: #2a2a2a transparent transparent transparent;
}

/* Contact section dark mode */
body.dark-mode .contact {
    background: #1f1f1f;
}

body.dark-mode .contact h2,
body.dark-mode .contact h3 {
    color: #e0e0e0;
}

/* Contact form dark mode */
body.dark-mode .contactblock form input[type="text"],
body.dark-mode .contactblock form input[type="email"],
body.dark-mode .contactblock form textarea,
body.dark-mode .contactblock form select {
    background: #2a2a2a;
    color: #e0e0e0;
    outline: 2px solid #444;
    border: 1px solid #444;
}

body.dark-mode .contactblock form input[type="text"]:focus,
body.dark-mode .contactblock form input[type="email"]:focus,
body.dark-mode .contactblock form textarea:focus,
body.dark-mode .contactblock form select:focus {
    outline: 2px solid #666;
    border: 1px solid #666;
}

body.dark-mode .contactblock form input::placeholder,
body.dark-mode .contactblock form textarea::placeholder {
    color: #888;
}

body.dark-mode .contactblock form button {
    background: #444;
    color: #e0e0e0;
}

body.dark-mode .contactblock form button:hover {
    background: #555;
}

body.dark-mode .contactblock form button:disabled {
    background: #333;
    color: #666;
}

/* Contact info dark mode */
body.dark-mode .contactinfo .infowrap {
    border-left: 1px solid #444;
}

body.dark-mode .contactinfo .infowrap .info {
    color: #e0e0e0;
}

body.dark-mode .contactinfo h4 {
    color: #e0e0e0;
}

body.dark-mode .contactinfo p {
    color: #b0b0b0;
}

body.dark-mode .contactinfo p a {
    color: #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

/* Footer dark mode */
body.dark-mode footer {
    background: #121212;
    color: #e0e0e0;
}

body.dark-mode footer .copyright {
    color: #e0e0e0;
}

body.dark-mode footer .copyright a {
    color: #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

body.dark-mode .socialmedia a {
    color: #e0e0e0;
}

body.dark-mode .socialmedia a:hover {
    color: #ccc;
}

/* Subject validator dark mode */
body.dark-mode #subject-validation-message {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
}

/* Success messages in dark mode */
body.dark-mode #subject-validation-message.success {
    background: #1a4d3a !important;
    color: #4ade80 !important;
    border: 1px solid #16a34a !important;
}

/* Warning messages in dark mode */
body.dark-mode #subject-validation-message.warning {
    background: #4d3a1a !important;
    color: #fbbf24 !important;
    border: 1px solid #f59e0b !important;
}

/* Error messages in dark mode */
body.dark-mode #subject-validation-message.error {
    background: #4d1a1a !important;
    color: #f87171 !important;
    border: 1px solid #ef4444 !important;
}

/* Images in dark mode - add subtle overlay */
body.dark-mode img {
    filter: brightness(0.8) contrast(1.1);
    transition: filter 0.3s ease;
}

body.dark-mode img:hover {
    filter: brightness(0.9) contrast(1.2);
}

/* Logo specific styling - prevent darkening and add background */
body.dark-mode .logo img {
    filter: none !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
    padding: 10px 15px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

body.dark-mode .logo img:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.95));
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Logo container styling for better integration */
body.dark-mode .logo {
    position: relative;
    transition: all 0.3s ease;
}

/* If the logo is too bright, add a subtle overlay option */
body.dark-mode .logo.invert-logo img {
    filter: invert(1) !important;
    background: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Alternative minimal approach - just remove the filter */
body.dark-mode .logo.minimal img {
    filter: none !important;
    background: none !important;
    opacity: 0.9;
}

body.dark-mode .logo.minimal img:hover {
    opacity: 1;
}

/* Smooth transitions for all elements */
body.dark-mode * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Scrollbar dark mode */
body.dark-mode::-webkit-scrollbar {
    width: 12px;
}

body.dark-mode::-webkit-scrollbar-track {
    background: #1a1a1a;
}

body.dark-mode::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 6px;
}

body.dark-mode::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animation for mode transition */
.dark-mode-transition {
    transition: background-color 0.5s ease, color 0.5s ease !important;
}

.dark-mode-transition * {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease !important;
}

/* Prevent content shift during transitions */
body {
    overflow-x: hidden; /* Prevent horizontal scrollbar */
}

/* Ensure consistent layout during mode transitions */
.dark-mode-transition {
    overflow-x: hidden !important;
}

/* Fix for potential width calculation issues */
* {
    box-sizing: border-box;
}