/* Custom Styles for UBD Technology */
:root {
    --primary-color: #2c5282;
    --secondary-color: #3182ce;
    --accent-color: #f7fafc;
    --text-dark: #2d3748;
    --text-light: #718096;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Custom Bootstrap Overrides */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Top Bar */
.top-bar {
    font-size: 0.875rem;
}

.top-bar a {
    text-decoration: none;
    transition: opacity 0.3s;
}

.top-bar a:hover {
    opacity: 0.8;
}

/* Navigation */
.navbar-brand {
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 0.5rem;
    transition: color 0.3s;
}

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

/* Dropdown Menu */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -6px;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.min-vh-75 {
    min-height: 75vh;
}

/* New Card Styles */
.card-new {
    position: relative;
    overflow: hidden;
    margin: 10px;
    min-width: 220px;
    max-width: 310px;
    width: 100%;
    background: #5a5a5a;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.card-new * {
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
}

.card-new img {
    max-width: 100%;
    height: 230px;
    object-fit: contain;
    background: #ffffff; /* Match viewmore.php */
}

.card-new .card-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin: 10px 0;
    color: white;
}

.card-new .card-overlay {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: rgb(0 0 0 / 64%);
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: calc(100% - 50px); /* Adjust for title height */
    opacity: 0;
}

.card-new .card-overlay p {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: white;
    line-height: 1.6;
}

.card-new .card-overlay .btn {
    margin-top: 10px;
}

.card-new:hover .card-overlay,
.card-new.hover .card-overlay {
    bottom: 50px; /* Slide up to cover image, leaving title visible */
    opacity: 1;
}

.card-new .card-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Service Cards */
.card.h-100.shadow-sm.hover-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card.h-100.shadow-sm.hover-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card.h-100.shadow-sm.hover-card .card-body {
    padding: 2rem;
}

.card.h-100.shadow-sm.hover-card .card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.card.h-100.shadow-sm.hover-card .card-text {
    font-size: 1rem;
    color: var(--text-light);
}

.card.h-100.shadow-sm.hover-card .btn-primary {
    margin-top: 1rem;
}

/* Page Headers */
.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 6rem 0 4rem;
    color: white;
    position: relative;
    z-index: 1;
}

.page-header.construction-works {
    background: url('../images/construction.jpg') no-repeat center center/cover;
    padding: 6rem 0 4rem;
    color: white;
}

.page-header h1 {
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: #ffffff;
    text-decoration: none;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    font-weight: 500;
    transition: color 0.3s;
}

.breadcrumb-item a:hover {
    color: var(--accent-color);
}

.breadcrumb-item.active {
    color: #ffffff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    font-weight: 600;
}

/* Heartbeat Animation for Breadcrumb Items */
.breadcrumb-item {
    animation: heartbeat 1.5s ease-in-out infinite;
    display: inline-block;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    10% {
        transform: scale(1.1);
    }
    20% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.05);
    }
    40% {
        transform: scale(1);
    }
}

/* Black and White Style for Breadcrumb */
.breadcrumb-item a, .breadcrumb-item.active {
    color: #ffffff; /* White text for contrast */
    background: none; /* No background overlay */
}

/* Contact Form */
.contact-form {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Timeline */
.timeline {
    position: relative;
    padding: 2rem 0;
}

.timeline-item {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 12px;
    width: 2px;
    height: calc(100% + 20px);
    background: #e2e8f0;
}

.timeline-item:last-child::after {
    display: none;
}

/* Portfolio Grid */
.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 82, 130, 0.9);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

/* Construction Works Carousel */
.construction-carousel .carousel-inner {
    overflow: hidden;
}

.construction-carousel .carousel-item {
    transition: transform 0.6s ease-in-out;
}

.construction-carousel .carousel-item img {
    max-height: 400px;
    object-fit: cover;
}

.construction-carousel .carousel-control-prev,
.construction-carousel .carousel-control-next {
    width: 5%;
    background: rgba(0, 0, 0, 0.3);
}

.construction-carousel .carousel-control-prev-icon,
.construction-carousel .carousel-control-next-icon {
    background-size: 50%;
}

/* Responsive */
@media (max-width: 767px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .page-header h1 {
        font-size: 2.5rem;
    }
    
    .counter {
        font-size: 2rem;
    }
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Loading Animation */
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.dropdown-submenu .dropdown-toggle::after {
    border: none;
    content: "\f0da";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    float: right;
    margin-top: -23px !important;
}

a:hover {
    --bs-link-color-rgb: var(--bs-link-hover-color-rgb);
    color: #fff;
}

/* Updated Carousel Styles for Smooth Sliding */
.carousel-inner {
    overflow: visible; /* Allow inactive items to be partially visible during transition */
    position: relative;
}

.carousel-item {
    display: block; /* Render all items */
    position: absolute; /* Position for sliding */
    width: 100%;
    opacity: 0; /* Hide inactive items via opacity */
    transition: transform 0.6s ease-in-out, opacity 0.6s ease-in-out; /* Smooth transform and opacity */
}

.carousel-item.active {
    display: block;
    position: relative; /* Active item in normal flow */
    opacity: 1; /* Fully visible */
}

.carousel-item-next,
.carousel-item-prev {
    display: block;
    opacity: 0.5; /* Partial visibility during transition */
}

.carousel-item-next.carousel-item-left,
.carousel-item-prev.carousel-item-right {
    opacity: 1; /* Smooth transition to active state */
}

.carousel-item .row {
    flex-wrap: nowrap;
    overflow-x: hidden; /* Prevent horizontal scroll within item */
    margin: 0; /* Remove default margins */
}

.carousel-item .col-lg-3,
.carousel-item .col-md-4,
.carousel-item .col-sm-6,
.carousel-item .col-12 {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 0 15px; /* Match Bootstrap gutter */
}

/* Extra Small Devices: 1 card */
@media (max-width: 575px) {
    .carousel-item .col-12 {
        width: 100%;
    }
}

/* Small Devices: 2 cards */
@media (min-width: 576px) and (max-width: 767px) {
    .carousel-item .col-sm-6 {
        width: 50%;
    }
}

/* Medium Devices: 3 cards */
@media (min-width: 768px) and (max-width: 991px) {
    .carousel-item .col-md-4 {
        width: 33.33%;
    }
}

/* Large Devices: 4 cards */
@media (min-width: 992px) {
    .carousel-item .col-lg-3 {
        width: 25%;
    }
}

/* Portfolio Carousel Overlay */
.portfolio-item .portfolio-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

/* Smooth scrolling for mobile */
.carousel-item .row::-webkit-scrollbar {
    display: none;
}

.carousel-item .row {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Adjust carousel controls */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    background: rgba(0, 0, 0, 0.3);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-size: 50%;
}

/* Ensure large numbers in counters are formatted properly */
.counter {
    display: inline-block;
    min-width: 100px; /* Prevent layout shift for large numbers */
    text-align: center;
}

/* Hero Section Background and Overlay */
.hero {
    position: relative;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%), 
                url('../images/construction.jpg') no-repeat center center/cover;
    background-blend-mode: overlay;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    --color-left: rgba(0, 0, 0, 0.2);
    --color-right: rgba(255, 255, 255, 0.2);
    background: linear-gradient(90deg, var(--color-left), var(--color-right));
    animation: wind-overlay 10s ease-in-out infinite;
    z-index: 0;
}

@keyframes wind-overlay {
    0% {
        --color-left: rgba(0, 0, 0, 0.2); /* Black */
        --color-right: rgba(255, 255, 255, 0.2); /* White */
    }
    16.67% {
        --color-left: rgba(32, 32, 32, 0.2); /* Very dark gray */
        --color-right: rgba(224, 224, 224, 0.2); /* Very light gray */
    }
    33.33% {
        --color-left: rgba(64, 64, 64, 0.2); /* Dark gray */
        --color-right: rgba(192, 192, 192, 0.2); /* Light gray */
    }
    50% {
        --color-left: rgba(192, 192, 192, 0.2); /* Light gray */
        --color-right: rgba(64, 64, 64, 0.2); /* Dark gray */
    }
    66.67% {
        --color-left: rgba(224, 224, 224, 0.2); /* Very light gray */
        --color-right: rgba(32, 32, 32, 0.2); /* Very dark gray */
    }
    83.33% {
        --color-left: rgba(255, 255, 255, 0.2); /* White */
        --color-right: rgba(0, 0, 0, 0.2); /* Black */
    }
    100% {
        --color-left: rgba(0, 0, 0, 0.2); /* Black */
        --color-right: rgba(255, 255, 255, 0.2); /* White */
    }
}

/* Contact Form Styling */
.contact-form {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.contact-form .form-control {
    border-radius: 5px;
    border: 1px solid var(--text-light);
}

.contact-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(44, 82, 130, 0.3);
}

.contact-form .btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.contact-form .btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Responsive Form */
@media (max-width: 767px) {
    .hero .row {
        flex-direction: column;
    }
    .contact-form {
        margin-top: 2rem;
    }
}

/* Ensure carousel controls are visible */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    background: rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.active>.page-link, .page-link.active {
    z-index: 3;
    color: var(--bs-pagination-active-color);
    background-color: #3d4043;
    border-color: #000000;
}

.page-link {
    position: relative;
    display: block;
    padding: var(--bs-pagination-padding-y) var(--bs-pagination-padding-x);
    font-size: var(--bs-pagination-font-size);
    color: #000000;
    text-decoration: none;
    background-color: var(--bs-pagination-bg);
    border: var(--bs-pagination-border-width) solid var(--bs-pagination-border-color);
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.bg-light {
    --bs-bg-opacity: 1;
    background-color: rgb(255 255 255) !important;
}