/* Theme Variables: Defines the color scheme for light and dark modes */
:root[data-theme="light"] {
    --bg-color: #ffffff; /* Background color for the entire page */
    --text-color: #212529; /* Default text color */
    --navbar-bg: #f8f9fa; /* Background color for the navbar */
    --card-bg: #ffffff; /* Background color for cards */
    --card-border: rgba(0, 0, 0, 0.2); /* Border color for cards */
    --text-bg-overlay: rgba(255, 255, 255, 0.9); /* Background for text overlays */
    --text-shadow: none; /* Text shadow for improved readability */
    --shadow-color: rgba(0, 0, 0, 0.1); /* Shadow color for various elements */
    --border-color: rgba(0, 0, 0, 0.1); /* Default border color */
    --navbar-shrink-bg: rgba(248, 249, 250, 0.95); /* Navbar background when shrink is active */
    --contact-card-bg: rgba(255, 255, 255, 0.9); /* Background for contact cards */
    --contact-text: #212529; /* Text color for contact sections */
    --contact-link: #007bff; /* Link color for contact sections */
    --contact-link-hover: #0056b3; /* Hover color for contact links */
    --contact-border: rgba(0, 0, 0, 0.1); /* Border color for contact sections */
    --link-color: #007bff;
    --link-hover-color: #0056b3;
}

:root[data-theme="dark"] {
    --bg-color: #212529; /* Background color for the entire page */
    --text-color: #f8f9fa; /* Default text color */
    --navbar-bg: #343a40; /* Background color for the navbar */
    --card-bg: #343a40; /* Background color for cards */
    --card-border: rgba(255, 255, 255, 0.2); /* Border color for cards */
    --text-bg-overlay: rgba(33, 37, 41, 0.85); /* Background for text overlays */
    --text-shadow: none; /* Text shadow for improved readability */
    --shadow-color: rgba(255, 255, 255, 0.1); /* Shadow color for various elements */
    --border-color: rgba(255, 255, 255, 0.1); /* Default border color */
    --navbar-shrink-bg: rgba(52, 58, 64, 0.95); /* Navbar background when shrink is active */
    --contact-card-bg: rgba(0, 0, 0, 0.8); /* Background for contact cards */
    --contact-text: white; /* Text color for contact sections */
    --contact-link: rgba(255, 255, 255, 0.9); /* Link color for contact sections */
    --contact-link-hover: white; /* Hover color for contact links */
    --contact-border: rgba(255, 255, 255, 0.2); /* Border color for contact sections */
    --link-color: #0d6efd;
    --link-hover-color: #0b5ed7;
}

/* Base Styles: Basic styles for the entire page */
html {
    height: 100%; /* Ensure the html element takes up the full height of the viewport */
}

body {
    min-height: 100vh;
    position: relative;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

/* Component Base Styles with Themes: Styles for common components with theme integration */
.navbar {
    background-color: var(--navbar-bg) !important;
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1rem;
    transition: all 0.3s ease;
    z-index: 1000;
}

.navbar.shrink {
    padding: 0.5rem;
    box-shadow: 0 2px 4px var(--shadow-color);
    background-color: var(--navbar-shrink-bg) !important;
}

/* Remove redundant theme-specific navbar shrink styles */

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 600;
    transition: transform 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    position: relative;
    transition: color 0.3s ease, transform 0.3s ease;
}

.nav-link:hover {
    transform: scale(1.05);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--text-color);
    transition: all 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
    left: 0;
}

/* Floating Contact Button: Styles for the floating contact button */
.floating-contact {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.floating-contact .btn {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 12px;
}

.floating-contact .btn i {
    font-size: 1.25rem;
}

/* Dark theme specific styles */
:root[data-theme="dark"] .floating-contact .btn {
    background-color: #0d6efd;
    border-color: #0a58ca;
}

/* Contact Logo Styles: Styles for the contact logo */
.contact-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* Make logo bigger on larger screens */
@media (min-width: 768px) {
    .contact-logo {
        width: 48px;
        height: 48px;
    }
    
    .floating-contact .btn {
        width: 60px;
        height: 60px;
        padding: 16px;
    }
    
    .floating-contact .btn i {
        font-size: 1.5rem;
    }
}

/* Theme Toggle Button Styles: Styles for the theme toggle button */
.theme-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon {
    width: 20px;
    height: 20px;
    position: absolute;
}

.sun-icon {
    opacity: 1;  /* Changed: visible by default in dark mode */
}

.moon-icon {
    opacity: 0;  /* Changed: hidden by default in dark mode */
}

/* Dark theme icon states - Now reversed */
:root[data-theme="light"] .sun-icon {
    opacity: 0;
}

:root[data-theme="light"] .moon-icon {
    opacity: 1;
}

/* Dark theme navigation and footer styles */
:root[data-theme="dark"] .navbar {
    background-color: var(--navbar-bg) !important;
}

:root[data-theme="dark"] .navbar-light .navbar-brand,
:root[data-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: #fff;
}

:root[data-theme="dark"] .navbar-light .navbar-nav .nav-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

:root[data-theme="dark"] .navbar-light .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

:root[data-theme="dark"] .navbar-light .navbar-toggler {
    border-color: var(--border-color);
}

:root[data-theme="dark"] footer {
    background-color: var(--navbar-bg) !important;
    color: #fff;
}

:root[data-theme="dark"] footer small {
    color: rgba(255, 255, 255, 0.9);
}

/* Footer Styles: Styles for the footer section */
footer {
    background-color: var(--navbar-bg);
    color: var(--text-color);
    text-align: center;
    padding: 1rem 0;
    margin-top: auto;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
}

footer small {
    font-size: 0.9rem;
    opacity: 0.9;
}

:root[data-theme="light"] footer {
    background-color: #f8f9fa;
    color: #212529;
}

/* Card Theme Styles: Styles for cards with theme integration */
.card, .themed-section .card {
    background-color: var(--card-bg);
    border-color: var(--card-border);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.card-title, .card-body h4, .card-body p {
    color: var(--text-color);
}

.card-body p {
    opacity: 0.8;
}

/* Modal Theme Styles: Styles for modals with theme integration */
.modal-content {
    background-color: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

.modal-header {
    border-bottom-color: var(--border-color);
}

.modal-footer {
    border-top-color: var(--border-color);
}

/* Form Theme Styles: Styles for forms with theme integration */
.form-label, .form-text {
    color: var(--text-color);
}

.form-control {
    background-color: var(--bg-color);
    border-color: var(--border-color);
    color: var(--text-color);
}

.form-control:focus {
    background-color: var(--bg-color);
    border-color: #0d6efd;
    color: var(--text-color);
}

.form-text {
    opacity: 0.6;
}

/* Section Theme Styles: Styles for sections with theme integration */
.features-section {
    background-color: var(--bg-color) !important;
}

.features-section .bg-light {
    background-color: var(--navbar-bg) !important;
}

.features-section .text-dark {
    color: var(--text-color) !important;
}

/* Dark mode overrides for features and service sections */
:root[data-theme="dark"] .features-section .bg-body-secondary,
:root[data-theme="dark"] .service-intro .bg-body-secondary {
    background-color: var(--card-bg) !important;
}

:root[data-theme="dark"] .features-section h3,
:root[data-theme="dark"] .service-intro h3 {
    color: var(--text-color) !important;
}

.themed-section {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.themed-section .hover-effect:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

/* Name Tag Styles: Styles for name tags with theme integration */
.name-background {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    text-decoration: none;
    transform: translateY(0);
    box-shadow: var(--shadow-color);
    font-size: 0.9rem;
    background-color: var(--text-bg-overlay);
    color: var(--text-color);
}

.name-background:hover {
    transform: translateY(-5px) scale(1.05);
    text-decoration: none;
    background-color: var(--card-bg);
    box-shadow: var(--shadow-color);
}

/* Map Container Theme: Styles for the map container with theme integration */
.map-container {
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

:root[data-theme="dark"] .map-container {
    filter: brightness(0.8) contrast(1.2);
}

/* Button Theme Styles: Styles for buttons with theme integration */
.btn-close {
    filter: invert(var(--theme-invert, 0)) grayscale(100%) brightness(200%);
}

/* Contact Page Theme Styles: Styles for the contact page with theme integration */
.contact-form-card {
    background: var(--contact-card-bg);
    border: none;
    color: var(--contact-text);
}

.contact-page .card {
    background: var(--contact-card-bg);
    border: none;
    color: var(--contact-text);
}

.contact-form-card .form-label,
.contact-form-card .card-title {
    color: var(--contact-text);
}

.contact-form-card .form-text {
    color: var(--text-color);
    opacity: 0.7;
}

.contact-form-card .quick-contact a {
    color: var(--contact-link);
}

.contact-form-card .quick-contact a:hover {
    color: var(--contact-link-hover);
    text-decoration: none;
}

.contact-page .card {
    background: var(--contact-card-bg);
    border: none;
    color: var(--contact-text);
}

@media (max-width: 768px) {
    .contact-page .col-md-4 {
        border-top: 1px solid var(--contact-border);
    }
}

/* Hero Section Styles: Styles for the hero section */
.hero {
    position: relative;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Add responsive adjustments for mobile */
@media (max-width: 768px) {
    .hero {
        height: auto;
        min-height: 100vh;
    }

    body {
        height: auto;
        overflow-y: visible;
    }
}

/* Dark mode override for .text-muted */
:root[data-theme="dark"] .text-muted {
    --bs-text-opacity: 1;
    color: rgba(255, 255, 255, 0.75) !important;
}

/* Semi-transparent content box styles */
.content-box {
    background-color: var(--text-bg-overlay);
    padding: 2rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px var(--shadow-color);
}

:root[data-theme="light"] .content-box {
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
}

:root[data-theme="dark"] .content-box {
    background-color: rgba(33, 37, 41, 0.85);
    color: var(--text-color);
}

/* Text visibility wrapper styles */
.text-wrapper {
    background-color: var(--text-bg-overlay);
    padding: 0.5rem 1.5rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(5px);
    display: inline-block;
    border: 1px solid var(--border-color);
    margin-bottom: 2rem; /* Add margin to create space */
}

:root[data-theme="light"] .text-wrapper {
    background-color: rgba(255, 255, 255, 0.85);
    color: var(--text-color);
}

:root[data-theme="dark"] .text-wrapper {
    background-color: rgba(33, 37, 41, 0.75);
    color: var(--text-color);
}

/* Login Modal Styles */
.login-modal {
    background-color: var(--bg-color);
    color: var(--text-color);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.login-modal .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.login-modal .modal-body {
    padding: 1.5rem;
}

.login-modal .modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem;
}

.login-modal .form-control {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.login-modal .form-control:focus {
    border-color: var(--link-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.login-modal .form-label {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.login-modal .form-check-label {
    color: var(--text-color);
}

.login-modal .form-check-input {
    background-color: var(--bg-color);
    border-color: var(--border-color);
}

.login-modal .form-check-input:checked {
    background-color: var(--link-color);
    border-color: var(--link-color);
}

.forgot-password-link {
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.15s ease-in-out;
}

.forgot-password-link:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

.login-modal .btn-primary {
    background-color: var(--link-color);
    border-color: var(--link-color);
}

.login-modal .btn-primary:hover {
    background-color: var(--link-hover-color);
    border-color: var(--link-hover-color);
}

.login-modal .btn-outline-secondary {
    color: var(--text-color);
    border-color: var(--border-color);
}

.login-modal .btn-outline-secondary:hover {
    background-color: var(--border-color);
    color: var(--text-color);
}