/********** Template CSS **********/
:root {
    --primary: #F3BD00;
    --secondary: #757575;
    --light: #F3F6F8;
    --dark: #0C2B4B;
}

/*** Layout Shift Prevention ***/
/* Reserve space for carousel to prevent CLS */
#header-carousel {
    min-height: 600px;
    height: 600px;
}

#header-carousel .carousel-inner,
#header-carousel .carousel-item {
    height: 600px;
}

#header-carousel img {
    object-fit: cover;
    height: 600px;
}

/* Prevent layout shifts for content containers */
.container-xxl {
    min-height: 50px; /* Reserve minimum height */
}

/* Reserve space for social media posts to prevent loading shifts */
#fbpost2 {
    min-height: 400px;
}

/* Prevent font loading layout shifts */
.display-6, .display-4, h1, h2, h3, h4, h5, h6 {
    font-display: swap;
}

/* Optimize topbar to prevent layout shifts */
.bg-dark.text-light {
    min-height: 50px;
}

/* Facts section with background image styling */
.container-fluid.facts {
    position: relative;
    min-height: 400px;
    background-attachment: fixed !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Mobile optimization for background attachment */
@media (max-width: 768px) {
    .container-fluid.facts {
        background-attachment: scroll !important;
    }
}

/* Ensure text is readable over background */
.container-fluid.facts .text-white {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.container-fluid.facts .text-primary {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Mobile image optimization */
@media (max-width: 767px) {
    /* Ensure all images are responsive on mobile */
    img, picture img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* About section mobile optimization */
    .position-relative img {
        object-fit: cover;
        aspect-ratio: 4/3;
    }
    
    /* Logo mobile optimization */
    .navbar-brand img {
        max-height: 40px;
        width: auto;
    }
    
    /* Prevent horizontal scroll on mobile */
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
}

.py-6 {
    padding-top: 6rem;
    padding-bottom: 6rem;
}

.my-6 {
    margin-top: 6rem;
    margin-bottom: 6rem;
}

.back-to-top {
    position: fixed;
    display: none;
    right: 30px;
    bottom: 30px;
    z-index: 99;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease, opacity 0.3s ease;
    padding: 0;
    text-align: center;
    opacity: 0.3;
}

.back-to-top.show {
    display: flex;
}

.back-to-top:hover {
    bottom: 35px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.back-to-top i {
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    color: #fff;
    font-weight: 900;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8), 
                 1px 1px 0 #000, 
                 -1px -1px 0 #000, 
                 1px -1px 0 #000, 
                 -1px 1px 0 #000;
}

/* Mobile responsiveness for back-to-top button */
@media (max-width: 767.98px) {
    .back-to-top {
        right: 20px;
        bottom: 20px;
        width: 45px;
        height: 45px;
        padding: 0;
    }
    
    .back-to-top:hover {
        bottom: 25px;
    }
    
    .back-to-top i {
        font-size: 1.1rem;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        color: #fff;
        font-weight: 900;
        text-shadow: 0 0 3px rgba(0, 0, 0, 0.8), 
                     1px 1px 0 #000, 
                     -1px -1px 0 #000, 
                     1px -1px 0 #000, 
                     -1px 1px 0 #000;
    }
}

/* Ensure footer sticks to bottom */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}


/*** Spinner ***/
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}

#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
}


/*** Button ***/
.btn {
    font-weight: 500;
    transition: .5s;
}

.btn.btn-primary,
.btn.btn-outline-primary:hover {
    color: #FFFFFF;
}

.btn-square {
    width: 38px;
    height: 38px;
}

.btn-sm-square {
    width: 32px;
    height: 32px;
}

.btn-lg-square {
    width: 48px;
    height: 48px;
}

.btn-square,
.btn-sm-square,
.btn-lg-square {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: normal;
}


/*** Navbar ***/
.navbar.sticky-top {
    top: -100px;
    transition: .5s;
}

.navbar .navbar-brand,
.navbar a.btn {
    height: 80px
}

.navbar .navbar-nav .nav-link {
    margin-right: 30px;
    padding: 25px 0;
    color: var(--dark);
    font-weight: 500;
    text-transform: uppercase;
    outline: none;
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link.active {
    color: var(--primary);
}

.navbar .dropdown-toggle::after {
    border: none;
    content: "\f107";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    vertical-align: middle;
    margin-left: 8px;
}

@media (max-width: 991.98px) {
    .navbar .navbar-nav .nav-link  {
        margin-right: 0;
        padding: 10px 0;
    }

    .navbar .navbar-nav {
        border-top: 1px solid #EEEEEE;
    }
}

@media (min-width: 992px) {
    .navbar .nav-item .dropdown-menu {
        display: block;
        border: none;
        margin-top: 0;
        top: 150%;
        opacity: 0;
        visibility: hidden;
        transition: .5s;
    }

    .navbar .nav-item:hover .dropdown-menu {
        top: 100%;
        visibility: visible;
        transition: .5s;
        opacity: 1;
    }
}


/*** Header ***/
.carousel-caption {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(0, 0, 0, .75);
    z-index: 1;
}

.carousel-control-prev,
.carousel-control-next {
    width: 15%;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 3rem;
    height: 3rem;
    background-color: var(--primary);
    border: 10px solid var(--primary);
}

@media (max-width: 768px) {
    #header-carousel .carousel-item {
        position: relative;
        min-height: 450px;
    }
    
    #header-carousel .carousel-item img {
        position: absolute;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

.page-header {
    background: linear-gradient(rgba(0, 0, 0, .75), rgba(0, 0, 0, .75)), url(../img/carousel-1.webp) center center no-repeat;
    background-size: cover;
}

.breadcrumb-item+.breadcrumb-item::before {
    color: #999999;
}


/*** Facts ***/
@media (min-width: 991.98px) {
    .facts {
        position: relative;
        margin-top: -75px;
        z-index: 1;
    }
}


/*** Courses ***/
.courses {
    min-height: 100vh;
    background: linear-gradient(rgba(255, 255, 255, .9), rgba(255, 255, 255, .9)), url(../img/carousel-1.webp) center center no-repeat;
    background-attachment: fixed;
    background-size: cover;
}

.courses-item .courses-overlay {
    position: absolute;
    width: 100%;
    height: 0;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .5);
    overflow: hidden;
    opacity: 0;
    transition: .5s;
}

.courses-item:hover .courses-overlay {
    height: 100%;
    opacity: 1;
}


/*** Team ***/
.team-items {
    margin: -.75rem;
}

.team-item {
    padding: .75rem;
}

.team-item::after {
    position: absolute;
    content: "";
    width: 100%;
    height: 0;
    top: 0;
    left: 0;
    background: #FFFFFF;
    transition: .5s;
    z-index: -1;
}

.team-item:hover::after {
    height: 100%;
    background: var(--primary);
}

.team-item .team-social {
    position: absolute;
    width: 100%;
    height: 0;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .75);
    overflow: hidden;
    opacity: 0;
    transition: .5s;
}

.team-item:hover .team-social {
    height: 100%;
    opacity: 1;
}


/*** Testimonial ***/
.testimonial-carousel .owl-dots {
    height: 40px;
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.testimonial-carousel .owl-dot {
    position: relative;
    display: inline-block;
    margin: 0 5px;
    width: 20px;
    height: 20px;
    background: transparent;
    border: 2px solid var(--primary);
    transition: .5s;
}

.testimonial-carousel .owl-dot.active {
    width: 40px;
    height: 40px;
    background: var(--primary);
}

.testimonial-carousel .owl-item img {
    width: 150px;
    height: 150px;
}


/*** Footer ***/
.footer .btn.btn-link {
    display: block;
    margin-bottom: 5px;
    padding: 0;
    text-align: left;
    color: var(--light);
    font-weight: normal;
    text-transform: capitalize;
    transition: .3s;
}

.footer .btn.btn-link::before {
    position: relative;
    content: "\f105";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: var(--light);
    margin-right: 10px;
}

.footer .btn.btn-link:hover {
    color: var(--primary);
    letter-spacing: 1px;
    box-shadow: none;
}

.copyright {
    background: #01073e;
    margin-bottom: 0 !important;
    padding-bottom: 1.5rem !important;
}

.copyright a {
    color: var(--primary);
}

.copyright a:hover {
    color: var(--light);
}

/*** Accessible Facts Section Links - WCAG 2.1 AA Compliant ***/
.facts h2 a {
    color: #1a5490; /* Dark blue for 6.2:1 contrast ratio on white background */
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-radius: 6px;
    padding: 4px 8px;
    display: inline-block;
    position: relative;
}

.facts h2 a:hover {
    color: #0f3a6b; /* Darker blue for hover state - 8.1:1 contrast */
    background-color: #f8f9fa; /* Light gray background on hover */
    text-decoration: underline;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(26, 84, 144, 0.2);
}

.facts h2 a:active {
    color: #0a2d54; /* Even darker blue for active state - 10.2:1 contrast */
    background-color: #e9ecef; /* Slightly darker gray for active */
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(26, 84, 144, 0.25);
}

.facts h2 a:focus {
    outline: 3px solid #1a5490;
    outline-offset: 2px;
    background-color: #fff3cd; /* Light yellow focus indicator */
}

/*** Alternative Yellow Theme - WCAG 2.1 AA Compliant ***/
.facts.yellow-theme h2 a {
    color: #8b4513; /* Saddle Brown - 4.51:1 contrast ratio on white */
    background: linear-gradient(135deg, #fff8dc 0%, #f5f5dc 100%); /* Beige gradient */
    border: 2px solid #daa520; /* Goldenrod border */
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    padding: 10px 16px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(218, 165, 32, 0.2);
}

.facts.yellow-theme h2 a:hover {
    color: #ffffff; /* White text - 7.26:1 contrast on gold background */
    background: linear-gradient(135deg, #daa520 0%, #b8860b 100%); /* Gold gradient */
    border-color: #b8860b; /* Dark goldenrod */
    text-decoration: none;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 12px rgba(218, 165, 32, 0.4);
}

.facts.yellow-theme h2 a:active {
    color: #ffffff; /* White text - 6.83:1 contrast */
    background: linear-gradient(135deg, #b8860b 0%, #9f7200 100%); /* Darker gold */
    border-color: #9f7200;
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 3px 6px rgba(218, 165, 32, 0.5);
}

.facts.yellow-theme h2 a:focus {
    outline: 3px solid #8b4513;
    outline-offset: 3px;
    background: linear-gradient(135deg, #fff8dc 0%, #f0e68c 100%); /* Light yellow focus */
    color: #8b4513;
}

/*** Modern Card Style Alternative ***/
.facts.card-style h2 a {
    color: #2c3e50; /* Dark slate - 7.37:1 contrast ratio */
    background: #ffffff;
    border: 2px solid #f39c12; /* Orange accent border */
    text-decoration: none;
    font-weight: 600;
    transition: all 0.4s ease;
    border-radius: 12px;
    padding: 12px 20px;
    display: inline-block;
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.15);
    position: relative;
    overflow: hidden;
}

.facts.card-style h2 a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(243, 156, 18, 0.1), transparent);
    transition: left 0.6s;
}

.facts.card-style h2 a:hover::before {
    left: 100%;
}

.facts.card-style h2 a:hover {
    color: #ffffff; /* White text - 9.84:1 contrast */
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); /* Orange gradient */
    border-color: #e67e22;
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(243, 156, 18, 0.3);
}

.facts.card-style h2 a:active {
    color: #ffffff; /* White text - 8.92:1 contrast */
    background: linear-gradient(135deg, #e67e22 0%, #d35400 100%); /* Darker orange */
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.4);
}



/*** Heading Hierarchy Styling ***/
/* Ensure proper heading sizes regardless of semantic level */

/* Style h2 in facts section to look like h5 */
.facts h2 {
    font-size: 1.25rem; /* Same as h5 */
    font-weight: 600;
    line-height: 1.2;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Style h3 in power service application to look like h6 when needed */
.power-service h3.step-title {
    font-size: 1rem; /* Same as h6 */
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

/* Style h2 in power service application to look like h4 */
.power-service h2.process-type {
    font-size: 1.5rem; /* Same as h4 */
    font-weight: 600;
    color: var(--primary);
}

/* Maintain visual consistency for area offices */
.area-office h2 {
    font-size: 1.25rem; /* Same as h5 */
    font-weight: 600;
    margin-top: 0.5rem;
}

/* AGMA download sections */
.agma-section h2 {
    font-size: 1.25rem; /* Same as h5 */
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Area managers names */
.area-manager h2 {
    font-size: 1.25rem; /* Same as h5 */
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Power advisories */
.power-advisory h2 {
    font-size: 1.25rem; /* Same as h5 */
    font-weight: 600;
    margin-top: 0.5rem;
}

/* RSS Feed Styling */
.text-orange {
    color: #ff6600 !important;
}

.btn-outline-primary:hover .fas,
.btn-outline-success:hover .fas,
.btn-outline-secondary:hover .fas {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* RSS feed alert styling */
.alert-info {
    border-left: 4px solid #ff6600;
}

.alert-info .text-orange {
    color: #ff6600 !important;
}

/* Style h2 for additional documents section to look like h6 */
.power-service h2:not(.process-type) {
    font-size: 1rem; /* Same as h6 */
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

/*** Contact Page Specific Styling ***/
.contact-item {
    transition: all 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

.contact-item .btn-square {
    transition: all 0.3s ease;
}

.contact-item:hover .btn-square {
    transform: scale(1.1);
}

.contact-item a {
    transition: all 0.3s ease;
}

.contact-item a:hover {
    color: var(--primary) !important;
    transform: translateX(5px);
}

.map-container {
    transition: all 0.3s ease;
}

.map-container:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15) !important;
}

/* Mobile optimizations for contact page */
@media (max-width: 767.98px) {
    .contact-item {
        flex-direction: column !important;
        text-align: center;
    }
    
    .contact-item .btn-square {
        margin: 0 auto 1rem auto !important;
    }
    
    .contact-item .flex-grow-1 {
        text-align: center;
    }
    
    .map-container iframe {
        height: 300px !important;
    }
}

@media (max-width: 991.98px) {
    .contact-item {
        margin-bottom: 2rem;
    }
}
