/* Additional Responsive & Functional CSS */

/* ===== FORM VALIDATION STYLES ===== */
.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(253, 93, 20, 0.25);
}

.contact-form input.is-invalid,
.contact-form textarea.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.contact-form .form-control:valid {
    border-color: #28a745;
}

/* Alert messages styling */
.alert {
    border-radius: 4px;
    animation: slideIn 0.3s ease-in;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RESPONSIVE IMPROVEMENTS ===== */

/* Mobile-first approach for topbar */
.container-fluid.px-5.d-none.d-lg-block {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
}

@media (max-width: 991.98px) {
    .container-fluid.px-5 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .navbar-overlay {
        width: 100%;
    }
    
    .carousel-caption {
        position: relative;
    }
    
    .carousel-caption h1 {
        font-size: 24px !important;
        line-height: 1.3;
    }
    
    .carousel-caption p {
        font-size: 14px;
    }
    
    .carousel-caption .btn {
        font-size: 12px;
        padding: 10px 20px !important;
    }
}

@media (max-width: 768px) {
    .page-header {
        height: 200px;
        min-height: 200px;
    }
    
    .page-header h1 {
        font-size: 28px;
        line-height: 1.2;
    }
    
    .service-item img {
        height: 200px;
        object-fit: cover;
    }
    
    .py-6 {
        padding-top: 45px !important;
        padding-bottom: 45px !important;
    }
    
    .px-5 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

@media (max-width: 576px) {
    .display-3 {
        font-size: 32px;
    }
    
    .display-5 {
        font-size: 24px;
    }
    
    .px-5 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .navbar-overlay {
        padding: 4px 8px;
    }
    
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ===== BUTTON & LINK ENHANCEMENTS ===== */

.btn {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.btn:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(253, 93, 20, 0.5);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Improve link keyboard navigation */
a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ===== INPUT FIELD IMPROVEMENTS ===== */

.form-control {
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    border-radius: 4px;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(253, 93, 20, 0.25);
}

.form-control::placeholder {
    opacity: 0.65;
}

/* ===== TABLE RESPONSIVENESS ===== */

@media (max-width: 768px) {
    .table-responsive {
        border: 0;
    }
    
    .table-responsive > .table {
        margin-bottom: 0;
    }
}

/* ===== CAROUSEL IMPROVEMENTS ===== */

.carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #000;
}

.carousel-item {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .carousel-item {
        min-height: 250px;
    }
}

/* ===== FLEX UTILITIES FOR RESPONSIVE LAYOUTS ===== */

.flex-wrap-mobile {
    flex-wrap: nowrap;
}

@media (max-width: 576px) {
    .flex-wrap-mobile {
        flex-wrap: wrap;
    }
}

/* ===== TEXT IMPROVEMENTS FOR MOBILE ===== */

@media (max-width: 576px) {
    h1, .h1 {
        font-size: 28px;
    }
    
    h2, .h2 {
        font-size: 24px;
    }
    
    h3, .h3 {
        font-size: 20px;
    }
    
    h4, .h4 {
        font-size: 18px;
    }
    
    h5, .h5,
    h6, .h6 {
        font-size: 16px;
    }
    
    p {
        font-size: 14px;
        line-height: 1.5;
    }
}

/* ===== NAVBAR MOBILE IMPROVEMENTS ===== */

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.75rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(253, 93, 20, 0.25);
    outline: 2px solid transparent;
}

.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.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ===== DROPDOWN MENU MOBILE IMPROVEMENTS ===== */

.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    animation: dropdownSlideIn 0.2s ease-in;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991.98px) {
    .dropdown-menu {
        background-color: rgba(4, 15, 40, 0.95);
        position: relative;
        float: none;
        width: 100%;
        margin-left: 0;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .dropdown-item {
        color: rgba(255, 255, 255, 0.75);
        text-transform: uppercase;
        padding: 0.75rem 1.5rem;
    }
    
    .dropdown-item:hover,
    .dropdown-item.active {
        background-color: rgba(253, 93, 20, 0.15);
        color: var(--primary);
    }
}

/* ===== FOOTER RESPONSIVE ===== */

@media (max-width: 768px) {
    .footer .row {
        row-gap: 30px !important;
    }
    
    .footer h4 {
        font-size: 18px;
        margin-bottom: 15px;
    }
}

/* ===== SERVICE ITEMS RESPONSIVE ===== */

.service-item {
    transition: all 0.3s ease;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.07);
}

.service-item:hover {
    box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

@media (max-width: 768px) {
    .service-item {
        margin-bottom: 20px;
    }
}

/* ===== PORTFOLIO RESPONSIVE ===== */

.portfolio-title {
    right: 15px;
    left: 15px;
    bottom: -40px;
    height: 100px;
    padding: 0 15px;
}

@media (max-width: 768px) {
    .portfolio-item {
        margin-bottom: 40px;
    }
    
    .portfolio-title {
        position: static;
        bottom: auto;
        height: auto;
        background: #f8f9fa;
        margin-top: 0;
    }
}

@media (max-width: 420px) {
    .container-fluid.px-5,
    .px-5 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .navbar-toggler {
        padding: 0.25rem 0.5rem;
    }

    .navbar-nav .nav-link {
        font-size: 14px;
        padding: 0.5rem 0.6rem;
    }

    .carousel-caption h1 {
        font-size: 22px !important;
    }

    .carousel-caption p {
        font-size: 13px;
    }

    .service-item .service-icon {
        width: 80px;
        height: 80px;
    }

    .service-item h4 {
        font-size: 16px;
    }

    .service-item p {
        font-size: 13px;
    }

    .service-item .btn {
        font-size: 13px;
        padding: 8px 14px;
    }

    .portfolio-title {
        padding: 0.75rem 1rem;
        height: auto;
    }

    .portfolio-title p {
        font-size: 16px;
    }

    .portfolio-title span {
        font-size: 12px;
    }

    #portfolio-flters li {
        width: calc(50% - 0.75rem);
        margin-bottom: 0.75rem;
    }

    #portfolio-flters li img {
        width: 100%;
        height: auto;
    }

    .footer .navbar-brand img {
        height: 45px;
    }

    .footer .row {
        row-gap: 25px !important;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== ===== */

/* Improve focus visibility for all interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Skip to main content link for screen readers */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 8px;
    z-index: 100;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

.skip-to-main:focus {
    top: 0;
}

/* ===== ANIMATION & TRANSITION IMPROVEMENTS ===== */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Prevent layout shift from scrollbar */
html {
    overflow-y: scroll;
}

/* ===== PRINT STYLES ===== */

@media print {
    .navbar,
    .footer,
    .back-to-top,
    .btn,
    .form-control {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */

@media (prefers-contrast: more) {
    .navbar-dark .navbar-nav .nav-link {
        font-weight: 700;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border-width: 2px;
    }
}

/* ===== DARK MODE SUPPORT (if user prefers) ===== */

@media (prefers-color-scheme: dark) {
    .bg-light {
        background-color: #2a2a2a !important;
        color: #e0e0e0;
    }
    
    .text-dark {
        color: #e0e0e0 !important;
    }
}

/* ===== REDUCED MOTION SUPPORT ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
