/* ==========================================
   Debtia Responsive CSS
   Mobile-first optimizations
   ========================================== */

/* ==========================================
   Large Tablets and below (< 992px)
   ========================================== */
@media (max-width: 991.98px) {
    /* Reduce section spacing */
    section {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }

    /* Reduce heading sizes */
    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.875rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    /* Stack columns earlier */
    .row > [class*="col-lg-"] {
        margin-bottom: 1.5rem;
    }

    .row > [class*="col-lg-"]:last-child {
        margin-bottom: 0;
    }
}

/* ==========================================
   Tablets and below (< 768px)
   ========================================== */
@media (max-width: 767.98px) {
    /* Typography adjustments */
    body {
        font-size: 15px;
    }

    h1 {
        font-size: 1.875rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    p {
        font-size: 0.95rem;
    }

    /* Section spacing */
    section {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    /* Container padding */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Hero section */
    .hero-section {
        min-height: 600px;
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 2rem !important;
    }

    .hero-subtitle {
        font-size: 1rem !important;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    /* CTA buttons */
    .cta-group {
        flex-direction: column;
        gap: 0.75rem;
    }

    .cta-group .btn {
        width: 100%;
        justify-content: center;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    /* Blog cards grid */
    .blog-grid {
        gap: 1rem;
    }

    .blog-card-title {
        font-size: 1.1rem;
    }

    /* Forms */
    .form-control,
    .form-select {
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Buttons */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
    }

    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    /* Tables - make scrollable */
    .table-responsive-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide on mobile utility */
    .hide-mobile {
        display: none !important;
    }

    /* Show on mobile utility */
    .show-mobile {
        display: block !important;
    }

    /* USP section */
    .usp-card {
        padding: 1.25rem;
    }

    .usp-icon {
        width: 48px;
        height: 48px;
    }

    /* Testimonials */
    .testimonial-card {
        padding: 1.5rem;
    }

    /* FAQ */
    .accordion-button {
        font-size: 1rem;
        padding: 1rem 1.25rem;
    }

    /* ==========================================
       Footer Mobile Optimizations
       ========================================== */

    /* Reduce footer container margin and border-radius */
    .site-footer {
        margin: 1.5rem 1rem 0;
        margin-left: 1rem;
        margin-right: 1rem;
        border-radius: 1.5rem;
    }

    /* Reduce CTA box padding */
    .site-footer .bg-secondary.bg-opacity-10 {
        padding: 1.5rem !important;
        margin-bottom: 2rem !important;
    }

    /* Footer CTA title - responsive sizing with clamp */
    .site-footer .bg-secondary.bg-opacity-10 h2.sec-title {
        font-size: clamp(1rem, 4vw, 1.5rem);
        margin-bottom: 1rem !important;
    }

    .site-footer .bg-secondary.bg-opacity-10 .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }

    /* Footer grid columns - keep 2x2 but optimize spacing */
    .site-footer .row.gy-4 {
        --bs-gutter-y: 1.5rem;
    }

    .site-footer .row > [class*="col-"] {
        text-align: left; /* Keep left aligned for readability */
    }

    .site-footer .row h6 {
        font-size: 0.9rem;
        margin-bottom: 0.75rem !important;
    }

    /* Footer links - better touch targets and spacing */
    .site-footer ul.list-unstyled li {
        line-height: 1.4;
    }

    .site-footer ul.list-unstyled li a {
        display: inline-block;
        padding: 0.125rem 0;
    }

    /* Footer address */
    .footer-address {
        font-size: 0.8rem;
    }

    .footer-address p {
        margin-bottom: 0.25rem;
    }

    /* Footer badge */
    .footer-badge {
        font-size: 0.55rem;
        padding: 0.2rem 0.4rem;
    }

    /* Address bar - stack info vertically */
    footer#footer .address-bar {
        margin-top: 2rem !important;
        padding-top: 1.5rem !important;
    }

    footer#footer .address-bar p {
        font-size: 0.75rem;
        line-height: 1.6;
    }

    /* Social icons - larger touch targets */
    footer#footer .address-bar .fs-5 {
        font-size: 1.25rem !important;
        padding: 0.5rem;
    }

    footer#footer .address-bar > div {
        gap: 0.5rem !important;
    }

    /* Copyright bar */
    .bg-light.text-center.py-3 {
        padding: 0.75rem !important;
    }

    .bg-light.text-center.py-3 small {
        font-size: 0.75rem;
    }

    /* Footer info items - stack vertically on mobile */
    .footer-info-text {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        align-items: center;
    }

    .footer-info-item {
        display: block;
    }

    /* Sticky CTA bar */
    .sticky-cta-bar {
        padding: 0.75rem 1rem;
    }

    .sticky-cta-bar .btn {
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
    }

    /* Back to top button */
    #debtia-back-to-top {
        width: 44px;
        height: 44px;
        right: 1rem;
        bottom: 5rem;
    }

    /* Pricing cards */
    .pricing-card {
        padding: 1.5rem;
    }

    .pricing-price {
        font-size: 2rem;
    }

    /* Partners swiper */
    .partners-swiper .swiper-slide img {
        max-height: 30px;
    }

    /* Pagetitle section */
    #pagetitle {
        padding: 3rem 0 2rem;
        min-height: auto;
    }

    #pagetitle h1 {
        font-size: 1.75rem;
    }

    /* Newsletter section */
    .debtia-newsletter-title {
        font-size: 1.5rem;
    }

    /* Steps/Process sections */
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Image containers - ensure proper aspect ratio */
    .img-fluid {
        max-width: 100%;
        height: auto;
    }

    /* Reduce animation distances on mobile for performance */
    .fade-from-left,
    .fade-from-right {
        transform: translateY(30px) !important; /* Convert to vertical */
    }

    .fade-from-top,
    .fade-from-bottom {
        transform: translateY(30px);
    }
}

/* ==========================================
   Small phones (< 576px)
   ========================================== */
@media (max-width: 575.98px) {
    /* Even smaller typography */
    h1 {
        font-size: 1.625rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    /* Tighter container */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Hero adjustments */
    .hero-section {
        min-height: 500px;
    }

    .hero-title {
        font-size: 1.625rem !important;
    }

    .btn-group .btn {
        width: auto;
    }

    /* Card padding */
    .card-body {
        padding: 1rem;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 1rem;
    }

    /* Badges */
    .badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }

    /* Lists */
    ul, ol {
        padding-left: 1.25rem;
    }

    /* Input groups */
    .input-group {
        flex-direction: column;
    }

    .input-group .form-control {
        border-radius: 0.5rem !important;
        margin-bottom: 0.5rem;
    }

    .input-group .btn {
        border-radius: 0.5rem !important;
        width: 100%;
    }

    /* Back to top - smaller */
    #debtia-back-to-top {
        width: 40px;
        height: 40px;
        right: 0.75rem;
        bottom: 4.5rem;
    }

    /* ==========================================
       Footer Small Phone Optimizations
       ========================================== */

    /* Even smaller footer margins */
    .site-footer {
        margin: 1rem 1rem 0;
        margin-left: 1rem;
        margin-right: 1rem;
        border-radius: 1.25rem;
    }

    .site-footer > .container {
        padding: 1.5rem 1rem !important;
    }

    /* Stack CTA buttons vertically */
    .site-footer .bg-secondary.bg-opacity-10 .d-flex {
        gap: 0.5rem !important;
    }

    /* Footer grid - single column on very small screens */
    .site-footer .row > [class*="col-6"] {
        padding-bottom: 1.25rem;
        margin-bottom: 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .site-footer .row > [class*="col-6"]:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    /* Center footer lists on small phones */
    .site-footer ul.list-unstyled {
        display: inline-block;
        text-align: left;
    }

    /* Footer info items - stack vertically on small phones */
    .footer-info-text {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        align-items: center;
    }

    .footer-info-item {
        display: block;
        font-size: 0.75rem;
    }
}

/* ==========================================
   Touch device optimizations
   ========================================== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    .nav-link,
    .dropdown-item,
    a {
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover effects that don't work well on touch */
    .btn:hover {
        transform: none;
    }

    .card:hover {
        transform: none;
    }

    /* Disable parallax on low-end mobile devices for performance */
    .parallax-bg {
        transform: none !important;
    }
}

/* ==========================================
   Landscape phone orientation
   ========================================== */
@media (max-width: 767.98px) and (orientation: landscape) {
    .hero-section {
        min-height: 400px;
        padding: 1.5rem 0;
    }

    .hero-title {
        font-size: 1.5rem !important;
    }

    /* Hide scroll indicator in landscape */
    .scroll-indicator {
        display: none;
    }
}

/* ==========================================
   Safe area insets for notched devices
   ========================================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .sticky-cta-bar {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    footer {
        padding-bottom: env(safe-area-inset-bottom);
    }

    #debtia-back-to-top {
        bottom: calc(5rem + env(safe-area-inset-bottom));
    }
}

/* ==========================================
   Print styles
   ========================================== */
@media print {
    /* Hide non-essential elements */
    .sticky-cta-bar,
    #debtia-back-to-top,
    .scroll-indicator,
    header nav,
    .crisp-client,
    .parallax-bg {
        display: none !important;
    }

    /* Reset backgrounds */
    body,
    .hero-section,
    .debtia-gradient {
        background: white !important;
        color: black !important;
    }

    /* Ensure text is readable */
    a {
        color: black !important;
        text-decoration: underline;
    }

    /* Show URLs after links */
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}

/* ==========================================
   Reduced motion preference
   ========================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in {
        opacity: 1 !important;
        transform: none !important;
    }

    .parallax-bg {
        transform: none !important;
    }

    html {
        scroll-behavior: auto;
    }
}
