/* /client/static/css/layout.css */

/* --- Main Container --- */
.container {
    margin-left: auto;
    margin-right: auto;
    max-width: 1200px;
    width: 100%;
    box-sizing: border-box;
}

/* --- Navigation Bar --- */
.navbar {
    background-color: var(--color-surface-card);
    border-bottom: 1px solid var(--color-border);
    padding-top: 0.5rem; /* Reduced padding for a slimmer navbar */
    padding-bottom: 0.5rem; /* Reduced padding for a slimmer navbar */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* Added a more pronounced shadow */
    /* --- Smart Navbar Styling --- */
    position: fixed; /* Changed from sticky to fixed for better control */
    width: 100%;
    top: 0;
    z-index: 1020; /* Ensures the navbar stays on top of other content */
    transition: transform 0.3s ease-in-out; /* Smooth transition for showing/hiding */
}

/* --- Flexbox layout for the navbar container --- */
.navbar > .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.navbar--hidden {
    transform: translateY(-100%); /* Hides the navbar by moving it up */
}

.navbar-light .navbar-nav .nav-link {
    color: var(--color-text);
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}

.navbar-light .navbar-nav .nav-link:hover {
    color: var(--color-primary);
}

/* Fix for active link visibility in dark mode */
.navbar-light .navbar-nav .active > .nav-link,
.navbar-light .navbar-nav .nav-link.active {
    color: var(--color-primary);
    font-weight: 700;
}

/* --- Navbar Logo Animation --- */
.navbar-brand {
    opacity: 0; /* Initial state for load-in animation */
    transform: translateY(-15px); /* Start slightly above */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}


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

.custom-nav .nav-item {
    margin-right: 20px; /* Reduced margin to prevent button text wrapping on desktop */
    opacity: 0; /* Initial state for load-in animation */
    transform: translateY(-15px); /* Start slightly above */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

/* --- Final state for animated items when navbar is loaded --- */
.navbar.navbar--loaded .navbar-brand {
    opacity: 1;
    transform: translateY(0);
}

.navbar.navbar--loaded .custom-nav .nav-item {
    opacity: 1;
    transform: translateY(0);
}

/* --- Staggered transition delays for a sequential effect --- */
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(1) { transition-delay: 0.1s; }
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(2) { transition-delay: 0.15s; }
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(3) { transition-delay: 0.2s; }
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(4) { transition-delay: 0.25s; }
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(5) { transition-delay: 0.3s; }
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(6) { transition-delay: 0.35s; }
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(7) { transition-delay: 0.4s; }
.navbar.navbar--loaded .custom-nav .nav-item:nth-child(8) { transition-delay: 0.45s; }

.dropdown-menu {
    background-color: var(--color-surface-card);
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-menu .dropdown-item {
    color: var(--color-text);
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}

.nav-item:hover .dropdown-menu {
    display: block;
}

.dropdown-menu a:hover {
    background-color: var(--color-primary);
    color: var(--color-text-inverse);
}

.logo {
    max-width: 100px;
    margin-right: 10px;
    /* --- Adaptive Logo Styling --- */
    border-radius: 50%; /* Ensures the frame is circular */
    border: 3px solid var(--color-surface); /* Adds a theme-aware border */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Adds a subtle shadow */
    transition: border-color 0.3s ease-in-out;
}

/* --- Breadcrumbs --- */
.breadcrumb-container {
    padding-top: 1rem;
    padding-bottom: 1rem;
    /* Removed border and changed background to match the page for a seamless look */
    background-color: var(--color-background);
}

.breadcrumb {
    background-color: transparent;
    margin-bottom: 0;
    padding: 0;
}

.breadcrumb-item a {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--color-text-muted);
    font-weight: 500;
}

/* --- Scroll-triggered Animations --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateX(-30px); /* Default: Start slightly to the left */
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform; /* Performance optimization */
}

/* Modifier to slide from the right instead */
.animate-on-scroll.slide-from-right {
    transform: translateX(30px); /* Override: Start slightly to the right */
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateX(0); /* Slide in to the final position */
}

/* --- General Section Styling --- */
.section-container {
    text-align: center;
    padding: 50px;
    background-color: var(--color-surface);
}

.centered-section {
    text-align: center;
}

/* Add padding to the top of the body to prevent content from hiding under the fixed navbar */
body {
    padding-top: 70px; /* Adjust this value based on the final navbar height */
}

/* --- Footer --- */
.footer-section {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 4rem 1rem; /* Increased padding for a more spacious feel */
    text-align: left;
}

.footer-section h3 {
    color: var(--color-footer-text);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-section p, .footer-section a {
    color: var(--color-footer-text);
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.newsletter-form .input-group {
    /* This ensures the input and button are perfectly vertically aligned */
    display: flex;
    align-items: center;
}

.newsletter-form .form-control {
    flex-grow: 1;
    border-radius: 5px 0 0 5px;
    border: 1px solid var(--color-border);
    background-color: var(--color-background);
    color: var(--color-text);
}

.newsletter-form .btn {
    border-radius: 0 5px 5px 0;
    background-color: var(--color-secondary);
    color: var(--color-text-inverse);
    border: 1px solid var(--color-secondary);
    padding: .375rem .75rem; 
}

.newsletter-form .btn:hover {
    background-color: #d48f2c; /* A slightly darker shade for hover */
    border-color: #d48f2c;
}

.widgets-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem; /* Adds space between wrapped items */
}

.widget {
    flex: 1 1 200px; /* Flex-grow, flex-shrink, and base width */
    min-width: 200px; /* Prevents widgets from becoming too narrow */
}

.social-icons {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.social-icon {
    margin: 0 8px;
}

.social-icon img {
    width: 30px;
    height: auto;
    transition: transform 0.2s ease-in-out;
}

.social-icon:hover img {
    transform: scale(1.1);
}

.copyright-text {
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 4rem;
}

.copyright-text a {
    color: var(--color-text-muted);
}

/* --- Theme Toggle Switch --- */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-switch {
    display: inline-block;
    height: 34px;
    position: relative;
    width: 60px;
}

.theme-switch input {
    display: none;
}

.slider {
    background-color: var(--color-primary);
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: background-color .4s;
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
    /* Sun icon for light mode */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23EBA340" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

input:checked + .slider {
    background-color: #4c566a; /* A neutral dark background */
}

input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
    /* Moon icon for dark mode */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%23f0b458" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"></path></svg>');
}

/* --- Social Icons in Mobile Navbar --- */
.navbar-social-icons {
    padding: 1rem 0;
}

.navbar-social-icons .social-icons {
    justify-content: flex-start; /* Align icons to the left */
    margin-top: 0; /* Remove top margin from footer version */
}

.navbar-social-icons hr {
    border-top: 1px solid var(--color-border);
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

/* --- Theme-Aware Cards & Modals --- */
.career-card, .modal-content {
    background-color: var(--color-surface-card);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.career-card .card-title {
    color: var(--color-text);
}

.career-card .btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    font-weight: 600;
}

.career-card .btn-secondary:hover {
    background-color: var(--color-surface-card);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

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

.modal-header .close {
    color: var(--color-text);
}

/* --- Responsive Navbar Adjustments --- */
@media (max-width: 991.98px) { /* Bootstrap's lg breakpoint */
    .navbar-nav .nav-item {
        padding: 0.5rem 0; /* Add vertical spacing to mobile menu items */
    }

    /* Style the "Support Us" button specifically in the mobile menu */
    .navbar-nav .nav-item .support-button {
        width: auto; /* Allow button to size to its content */
        float: right; /* Align to the right */
    }

    /* Center the theme toggle on mobile */
    .theme-switch-container {
        order: 1; /* Center position between logo (0) and toggler (2) */
    }

    /* --- Mobile Menu Scrolling Fix --- */
    .navbar-collapse.show {
        height: calc(100vh - 70px); /* Fill remaining viewport height (viewport - navbar height) */
        overflow-y: auto; /* Allow the menu itself to scroll if content is long */
    }

    .navbar-collapse.collapsing {
        height: 0 !important; /* Prevent jumpy behavior during transition */
    }

    /* --- Mobile Accordion Menu --- */
    .navbar-nav .dropdown-menu {
        position: static; /* Remove absolute positioning */
        float: none;
        width: auto;
        margin-top: 0;
        background-color: transparent; /* Make background transparent */
        border: 0;
        box-shadow: none;
        padding-left: 1.5rem; /* Indent sub-menu items */
    }

    .navbar-nav .dropdown-menu .dropdown-item {
        padding: 0.5rem 1rem;
        color: var(--color-text-muted); /* Subtler color for sub-items */
    }

    .navbar-nav .dropdown-menu .dropdown-item:hover {
        background-color: transparent;
        color: var(--color-primary);
    }

    .navbar-nav .dropdown-toggle::after {
        /* Style the dropdown arrow for the accordion */
        transition: transform 0.2s ease-in-out;
    }

    /* Rotate arrow when dropdown is shown */
    .navbar-nav .dropdown.show .dropdown-toggle::after {
        /* Point the arrow down when the accordion item is open */
        transform: rotate(90deg);
    }
}

/* --- Desktop Navbar Layout Adjustments --- */
@media (min-width: 992px) {
    .navbar > .container {
        flex-wrap: nowrap; /* Ensure items stay on one line */
    }
    /* Move theme toggle to the end on desktop */
    .theme-switch-container {
        order: 3;
        padding-left: 1rem; /* Add some space from the nav links */
    }
}
/* --- Responsive Layout --- */
@media (max-width: 768px) {
    .custom-nav .nav-item {
        margin-right: 15px;
    }
    .widget {
        flex-basis: 100%; /* Each widget takes full width on mobile */
        min-width: unset;
    }
}