/* 
 * Ensureify - Responsive Styles
 * For mobile and tablet devices
 * All code in this file is wrapped in media queries
 */

/* Large devices (desktops, 992px and up) */
@media (max-width: 1199px) {
    .hero-title {
        font-size: 3rem;
    }
    
    .section-title {
        font-size: 2.2rem;
    }
    
    .dropdown-mega-menu {
        padding: 25px !important;
    }
    
    .dropdown-mega-menu .border-start {
        padding-left: 25px !important;
    }
}

/* Medium devices (tablets, 768px to 991px) */
@media (max-width: 991px) {
    /* Header */
    .navbar-collapse {
        background-color: var(--white);
        padding: 20px;
        border-radius: var(--border-radius);
        margin-top: 15px;
        box-shadow: var(--shadow);
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .header.scrolled .navbar-collapse {
        background-color: var(--white);
    }
    
    .navbar-nav .nav-link {
        color: var(--primary-color);
        padding: 10px 0;
        border-bottom: 1px solid var(--gray-light);
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link.active,
    .navbar-nav .nav-link.show {
        color: var(--secondary-color);
    }
    
    .navbar-nav .nav-link::after {
        display: none;
    }
    
    .header .btn-contact {
        margin-top: 10px;
        display: inline-block;
    }
    
    /* Mega Menu Mobile Styling */
    .dropdown-mega .dropdown-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;

        i.fas {
            display: none;
        }
    }
    
    .dropdown-mega .dropdown-toggle::after {
        display: inline-block !important;
        margin-left: auto;
        border-top: 0.3em solid;
        border-right: 0.3em solid transparent;
        border-left: 0.3em solid transparent;
    }
    
    .dropdown-mega-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        transform: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 15px !important;
        margin-top: 10px;
        background-color: var(--gray-light);
        max-height: 55vh;
        overflow-y: auto;
    }
    
    .dropdown-mega-menu .row {
        display: block !important;
    }
    
    .dropdown-mega-menu .col-lg-6 {
        width: 100% !important;
        margin-bottom: 25px;
    }
    
    .dropdown-mega-menu .border-start {
        border-left: none !important;
        border-top: 1px solid var(--gray-medium);
        padding-top: 25px;
        margin-top: 25px;
        padding-left: 0 !important;
    }
    
    /* Hero Section */
    .hero-section {
        padding: 150px 0 80px;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-text {
        max-width: 100%;
        text-align: center;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    /* Stats */
    .stat-number {
        font-size: 2.5rem;
    }
    
    .stat-item {
        padding: 15px;
    }
    
    /* About Section */
    .about-content {
        margin-top: 40px;
    }
    
    .ps-lg-5 {
        padding-left: 0 !important;
    }
    
    /* Partners */
    .partner-logo {
        height: 100px;
        padding: 20px;
    }
    
    /* Testimonials */
    .testimonial-item {
        margin: 0 10px;
        padding: 30px;
    }
    
    .testimonial-text {
        min-height: auto;
    }
    
    /* FAQ */
    .faq-accordion .accordion-button {
        padding: 15px 20px;
        font-size: 1rem;
    }
    
    .faq-accordion .accordion-body {
        padding: 15px 20px;
    }
    
    /* Footer */
    .footer-widget {
        margin-bottom: 40px;
    }
    
    .newsletter-content {
        margin-bottom: 30px;
        text-align: center;
    }
    
    .footer-bottom-links {
        justify-content: flex-start;
        margin-top: 15px;
        flex-wrap: wrap;
    }
    
    /* Page Header */
    .page-header {
        padding: 80px 0 40px;
        text-align: center;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    /* Blog */
    .blog-single,
    .service-content {
        padding: 60px 0;
    }
    
    /* Contact */
    .contact-form {
        padding: 30px;
    }
    
    /* Claims */
    .process-step {
        padding-left: 70px;
    }
    
    /* Inner pages header */
    body:not(.page-home) .header {
        background-color: var(--white) !important;
    }
    
    /* Featured Post */
    .featured-post .card-body {
        padding: 20px;
    }
    
    .blog-sidebar {
        margin-top: 50px;
    }
    
    .featured-image img {
        height: 300px;
    }
    
    .post-meta .col-md-8,
    .post-meta .col-md-4 {
        text-align: center;
        margin-bottom: 15px;
    }
    
    .post-meta .col-md-4 {
        margin-bottom: 0;
    }
    
    /* Mobile menu background for inner pages */
    body:not(.page-home) .navbar-collapse {
        background-color: var(--white) !important;
        border: 1px solid var(--gray-medium);
    }
    
    body:not(.page-home) .navbar-nav .nav-link {
        color: var(--primary-color) !important;
        border-bottom: 1px solid var(--gray-light);
    }
    
    body:not(.page-home) .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    /* Responsive adjustments for claims */
    .process-line {
        display: none;
    }
    
    .process-step .step-content {
        padding: 25px 15px;
    }
    
    .complaints-procedure {
        padding-left: 0;
    }
    
    .step-by-step::before {
        display: none;
    }
    
    .step .step-number {
        position: static;
        margin-right: 15px;
        transform: none;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .step-header {
        display: flex;
        align-items: center;
        padding-left: 0;
    }
    
    .step {
        padding: 20px;
        margin-bottom: 30px;
    }
    
    /* Responsive for about page */
    .about-story {
        padding-right: 0;
        margin-bottom: 30px;
    }
    
    .contact-info-box {
        margin-bottom: 20px;
    }
    
    .team-card {
        margin-bottom: 20px;
    }
    
    .sum-card.popular {
        transform: none;
    }
}

/* Small devices (landscape phones, 576px to 767px) */
@media (max-width: 767px) {
    /* General */
    .section-padding {
        padding: 60px 0;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Header */
    .navbar-brand img {
        height: 35px;
    }
    
    .navbar-toggler {
        padding: 4px 8px;
        font-size: 1rem;
    }
    
    /* Hero */
    .hero-section {
        padding: 130px 0 60px;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-badge {
        font-size: 0.9rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .btn-get-started,
    .btn-watch-video {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    /* Stats */
    .stat-item {
        padding: 15px 10px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-text {
        font-size: 0.9rem;
    }
    
    /* About */
    .about-point {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        align-items: center;
    }
    
    .point-icon {
        margin: 0 auto;
    }
    
    .image-content {
        padding: 20px;
    }
    
    .image-content h4 {
        font-size: 1.2rem;
    }
    
    /* Partners */
    .col-6 {
        width: 50%;
    }
    
    .partner-logo {
        height: 90px;
        padding: 15px;
    }
    
    /* Services & Features */
    .service-card,
    .feature-card {
        padding: 25px 20px;
        margin-bottom: 20px;
    }
    
    .service-icon,
    .feature-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 15px;
    }
    
    .service-icon i,
    .feature-icon i {
        font-size: 1.5rem;
    }
    
    .category-title {
        font-size: 1.3rem;
    }
    
    /* Testimonials */
    .testimonial-item {
        padding: 25px 20px;
        margin: 0 5px;
    }
    
    .quote-icon {
        font-size: 3rem;
    }
    
    .slider-controls {
        margin-top: 30px;
    }
    
    .btn-slider {
        width: 45px;
        height: 45px;
    }
    
    /* CTA */
    .cta-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .cta-text {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .btn-cta-primary,
    .btn-cta-secondary {
        width: 100%;
        max-width: 300px;
        padding: 14px 25px;
    }
    
    /* Footer */
    .footer-top {
        padding-bottom: 40px;
    }
    
    .footer-widget {
        text-align: center;
        margin-bottom: 30px;
    }
    
    .footer-widget h5::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .social-icons {
        justify-content: center;
    }
    
    .newsletter-section {
        padding: 40px 0;
    }
    
    .newsletter-form .form-control,
    .newsletter-form .btn {
        height: 50px;
    }
    
    /* Blog Listing */
    .blog-sidebar {
        margin-top: 40px;
    }
    
    /* Blog Single */
    .blog-meta {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .blog-meta span {
        margin-right: 10px;
    }
    
    .post-navigation {
        flex-direction: column;
        gap: 20px;
    }
    
    .post-nav-link {
        max-width: 100%;
    }
    
    /* Contact */
    .contact-info-box {
        margin-bottom: 20px;
    }
    
    /* Claims */
    .process-step {
        padding-left: 0;
        padding-top: 70px;
        text-align: center;
    }
    
    .process-step:before {
        left: 50%;
        transform: translateX(-50%);
    }
    
    /* Accordion */
    .accordion-button {
        font-size: 1rem;
        padding: 15px;
    }
    
    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    /* Blog */
    .blog-image {
        height: 180px;
    }
    
    .blog-content {
        padding: 20px;
    }
    
    .blog-title {
        font-size: 1.1rem;
    }
    
    .featured-post .row {
        flex-direction: column;
    }
    
    .featured-post .col-md-6 {
        width: 100%;
    }
    
    .featured-image {
        min-height: 250px;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    .related-image {
        height: 180px;
    }
    
    .social-share {
        margin-top: 15px;
        text-align: center;
        width: 100%;
    }
    
    /* Service detail responsive */
    .type-icon {
        width: 60px;
        height: 60px;
        margin: 0 auto 20px;
    }
    
    .service-type-card {
        text-align: center;
    }
    
    .service-type-card ul {
        text-align: left;
    }
    
    .feature-box {
        padding: 20px !important;
    }
    
    /* Career responsive */
    .why-join-card {
        margin-bottom: 20px;
    }
    
    .job-card {
        margin-bottom: 20px;
    }
    
    .perk-card {
        margin-bottom: 20px;
    }
    
    .job-quick-info .row {
        text-align: center;
    }
    
    .job-quick-info .col-6 {
        margin-bottom: 15px;
    }
    
    /* Home insurance responsive */
    .coverage-card {
        margin-bottom: 15px;
    }
    
    .benefit-card {
        margin-bottom: 15px;
    }
    
    .reason-card {
        margin-bottom: 15px;
    }
    
    /* Product listing responsive */
    .category-title {
        font-size: 1.5rem;
    }
    
    .category-header .badge {
        font-size: 0.9rem;
        padding: 5px 10px;
    }
    
    .industry-card {
        margin-bottom: 15px;
    }
    
    .industry-card h6 {
        font-size: 0.8rem;
    }
    
    /* Group insurance responsive */
    .stats-box .display-5 {
        font-size: 2.2rem;
    }
    
    .reason-point {
        flex-direction: column;
        text-align: center;
    }
    
    .reason-number {
        margin: 0 auto 10px;
    }
    
    /* D&O responsive */
    .coverage-badge {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .coverage-section-card {
        text-align: center;
    }
    
    /* Professional indemnity responsive */
    .industry-coverage-card {
        text-align: center;
    }
    
    .industry-coverage-card .d-flex {
        flex-direction: column;
        text-align: center;
    }
    
    .industry-coverage-card .fa-2x {
        margin-right: 0 !important;
        margin-bottom: 10px;
    }
    
    .risk-card {
        text-align: center;
    }
    
    .risk-icon {
        margin: 0 auto 15px;
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575px) {
    /* Hero */
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-badge {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    /* Stats */
    .col-6 {
        width: 50%;
        padding: 5px;
    }
    
    .stat-number {
        font-size: 1.8rem;
    }
    
    /* Services */
    .service-tags .badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
    
    /* Testimonials */
    .testimonial-author h5 {
        font-size: 1rem;
    }
    
    .testimonial-author p {
        font-size: 0.85rem;
    }
    
    /* Blog */
    .blog-image {
        height: 180px;
    }
    
    .blog-content {
        padding: 20px;
    }
    
    .blog-content h4 {
        font-size: 1.1rem;
    }
    
    .blog-date {
        left: 10px;
        top: 10px;
        padding: 8px;
        min-width: 45px;
    }
    
    .blog-date .day {
        font-size: 1.2rem;
    }
    
    .blog-date .month {
        font-size: 0.8rem;
    }
    
    .tags-list .tag {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .author-bio .row {
        flex-direction: column;
        text-align: center;
    }
    
    .author-bio .col-md-3 {
        margin-bottom: 20px;
    }
    
    /* Footer */
    .footer-bottom-links {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    /* Mobile Navigation Enhancements */
    .navbar-collapse {
        padding: 15px;
        margin-top: 10px;
    }
    
    .dropdown-mega-menu {
        max-height: 50vh;
    }
    
    /* Forms */
    .contact-form {
        padding: 20px;
    }
    
    .form-control, .form-select {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    /* Mega Menu Mobile */
    .dropdown-item-group .dropdown-item {
        padding: 8px 10px;
    }
    
    .dropdown-icon {
        width: 30px;
        height: 30px;
        margin-right: 10px;
    }
    
    .dropdown-icon i {
        font-size: 0.9rem;
    }
    
    .dropdown-item-group .dropdown-item h6 {
        font-size: 0.9rem;
    }
    
    .dropdown-item-group .dropdown-item small {
        font-size: 0.75rem;
    }
}

/* Extra small devices in landscape */
@media (max-width: 767px) and (orientation: landscape) {
    .navbar-collapse {
        max-height: 60vh;
    }
    
    .dropdown-mega-menu {
        max-height: 50vh;
    }
    
    .hero-section {
        padding: 100px 0 60px;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-title {
        font-weight: 700;
    }
    
    .section-title {
        font-weight: 700;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .hero-buttons,
    .cta-buttons,
    .slider-controls,
    .newsletter-form {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* Accessibility Improvements */
@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;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #1a1a1a;
        --dark-color: #ffffff;
        --gray-light: #2d2d2d;
        --gray-medium: #4a4a4a;
        --gray-dark: #b0b0b0;
        --white: #000000;
        --black: #ffffff;
    }
    
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .service-card,
    .testimonial-item,
    .blog-card {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    .faq-accordion .accordion-button,
    .faq-accordion .accordion-body {
        background-color: #1e1e1e;
        color: #ffffff;
    }
    
    .dropdown-mega-menu {
        background-color: #1e1e1e;
    }
    
    .dropdown-item-group .dropdown-item:hover {
        background-color: #2d2d2d;
    }
}

/* Fix for iOS input zoom */
@media screen and (max-width: 767px) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Fix for sticky hover on mobile */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover,
    .feature-card:hover,
    .blog-card:hover {
        transform: none;
    }
    
    .dropdown-mega:hover .dropdown-mega-menu {
        display: none !important;

        &.show {
            display: block !important;
        }
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .btn-slider {
        width: 50px;
        height: 50px;
    }
}

/* Container width adjustments */
@media (max-width: 1399px) {
    .container {
        max-width: 1140px !important;
    }
}

@media (max-width: 1199px) {
    .container {
        max-width: 960px !important;
    }
}

@media (max-width: 991px) {
    .container {
        max-width: 720px !important;
    }
}

@media (max-width: 767px) {
    .container {
        max-width: 540px !important;
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 575px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Fix for Bootstrap modal backdrop on mobile */
@media (max-width: 991px) {
    .modal-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1040;
        width: 100vw;
        height: 100vh;
        background-color: #000;
    }
}

/* Grid system improvements for mobile */
@media (max-width: 767px) {
    .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    
    .row > [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* Fix for dropdown alignment on mobile */
@media (max-width: 991px) {
    .navbar-nav .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        margin-top: 0;
        background-color: transparent;
        border: none;
        box-shadow: none;
    }
    
    .dropdown-mega .dropdown-mega-menu {
        background-color: #f8f9fa;
        padding: 30px 0 !important;

        &.show {
            display: block !important;
        }
    }
}

/* Animation delays for better performance on mobile */
@media (max-width: 767px) {
    .service-card,
    .feature-card,
    .blog-card {
        transition: none;
    }
}

/* Prevent font boosting on mobile */
@media (max-width: 767px) {
    html {
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
}