/* Mobile-specific CSS for enhanced mobile experience */

/* Extra small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Adjust padding and margins for better mobile viewing */
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .card-body {
        padding: 1rem !important;
    }

    /* Adjust progress steps for mobile - keep horizontal but more compact */
    .progress-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1.5rem;
        width: 100%;
        padding: 10px 0;
    }

    .progress-steps {
        flex-direction: row !important;
        gap: 10px;
        padding: 15px 0;
        min-width: 350px; /* Ensure minimum width for scrolling */
        width: max-content; /* Allow content to determine width */
        border-radius: 12px;
        box-shadow: 0 0.3rem 0.8rem rgba(0, 0, 0, 0.08);
        overflow: hidden;
    }

    .progress-steps::before {
        display: none;
    }

    .progress-step {
        flex: 1 0 auto;
        min-width: 80px;
        padding: 0 5px;
    }

    .progress-step .circle {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
        border-width: 2px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    .progress-step.active .circle {
        transform: scale(1.15);
        box-shadow: 0 0 0 4px rgba(0, 128, 128, 0.25);
    }

    .progress-step .label {
        font-size: 0.7rem;
        line-height: 1.3;
        font-weight: 500;
    }

    /* Mobile verification steps redesign */
    .verification-steps-mobile {
        background: #f8f9fa;
        border-radius: 12px;
        padding: 20px 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        margin-top: 15px;
    }

    .steps-indicator {
        position: relative;
        margin-bottom: 30px !important;
    }

    .step {
        display: flex;
        flex-direction: column;
        align-items: center;
        z-index: 2;
        position: relative;
    }

    .step-number {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: #e9ecef;
        color: #6c757d;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 600;
        font-size: 1rem;
        margin-bottom: 8px;
        transition: all 0.3s ease;
        border: 2px solid #dee2e6;
    }

    .step-label {
        font-size: 0.75rem;
        color: #6c757d;
        text-align: center;
        font-weight: 500;
        line-height: 1.2;
    }

    .step.active .step-number {
        background: #008080;
        color: white;
        border-color: #008080;
        transform: scale(1.1);
    }

    .step.active .step-label {
        color: #008080;
        font-weight: 600;
    }

    .step.completed .step-number {
        background: #28a745;
        color: white;
        border-color: #28a745;
    }

    .step.completed .step-label {
        color: #28a745;
    }

    .step-separator {
        height: 2px;
        background: #dee2e6;
        margin: 0 4px;
        align-self: center;
        position: relative;
        top: 18px;
    }

    .step.completed + .step-separator {
        background: #28a745;
    }

    .steps-navigation {
        margin-top: 20px;
    }

    .btn-prev, .btn-next {
        padding: 10px 15px;
        font-size: 0.9rem;
        border-radius: 8px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-prev i, .btn-next i {
        font-size: 1rem;
    }

    /* Keep verification toggle buttons horizontal on mobile */
    .verification-toggle-container {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 15px;
        flex-wrap: nowrap;
    }

    .verification-toggle-container .form-check {
        margin-right: 0;
        margin-bottom: 0;
    }

    .verification-toggle-container .form-check-inline {
        display: flex;
        align-items: center;
        margin-right: 0;
    }

    .verification-toggle-container .form-check-input {
        margin-right: 5px;
    }

    .verification-toggle-container .form-check-label {
        font-size: 0.9rem;
        white-space: nowrap;
    }

    /* Adjust form elements for mobile */
    .form-label {
        font-size: 0.9rem;
    }

    .form-control, .form-select {
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }

    /* Adjust buttons for better touch targets */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 1rem;
        min-height: 44px; /* Minimum touch target size */
    }

    /* Adjust header for mobile */
    header .container {
        flex-direction: row;
        gap: 10px;
    }

    header .nav-pills {
        flex-wrap: wrap;
        justify-content: center;
    }

    header .nav-item {
        margin-bottom: 5px;
    }

    header .col-md-3 {
        width: 100%;
        text-align: center;
    }

    /* Keep logo and logout button on same line */
    header .d-flex.flex-wrap.justify-content-between.align-items-center {
        flex-wrap: nowrap !important;
    }

    header .d-flex.align-items-center.mb-3.mb-md-0.me-md-auto {
        flex: 1;
    }

    header .btn.btn-danger {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
        min-height: 30px;
    }

    /* Adjust footer for mobile */
    footer .container .d-flex:not(.footer-social-icons) {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    /* Keep social icons horizontal on mobile */
    footer .footer-social-icons {
        justify-content: center !important;
    }

    footer .footer-social-icons {
        width: 100%;
        text-align: center;
    }

    footer .nav {
        justify-content: center !important;
    }

    /* Adjust OTP input fields */
    .otp-input-group .form-control {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-right: 5px;
    }

    /* Adjust sidebar navigation */
    .kyc-sidebar {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding-right: 0;
        padding-bottom: 15px;
        margin-bottom: 15px;
    }

    .kyc-sidebar .nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .kyc-sidebar .nav-link {
        flex: 1 0 40%;
        text-align: center;
        padding: 8px 5px;
        font-size: 0.85rem;
    }

    /* Adjust radio buttons for mobile - icon only navigation */
    .form-check-inline {
        display: inline-block;
        margin-right: 5px;
        margin-bottom: 10px;
    }

    .form-check-label {
        padding: 0.75rem 0.75rem;
        min-width: auto;
        width: auto;
        font-size: 0.85rem;
    }

    /* Adjust instruction page content for mobile */
    .kyc-card .card-body {
        padding: 1rem !important;
    }

    .kyc-card .card-title {
        font-size: 1.4rem;
        margin-bottom: 1rem;
        color: #008080;
        text-align: center;
        font-weight: 600;
    }

    .kyc-card h4 {
        font-size: 1.1rem;
        color: #006666;
        margin-top: 1.5rem;
        margin-bottom: 1rem;
    }

    .kyc-card ol {
        padding-left: 1rem;
    }

    .kyc-card li {
        margin-bottom: 0.5rem;
    }

    .kyc-card ul {
        margin-bottom: 0.5rem;
    }

    /* Adjust card titles */
    .card-title {
        font-size: 1.5rem;
    }

    h4 {
        font-size: 1.2rem;
    }

    /* Adjust alerts */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Adjust progress steps */
    .progress-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0;
    }

    .progress-steps {
        padding: 20px 0;
        min-width: 400px;
    }

    .progress-step .circle {
        width: 40px;
        height: 40px;
    }

    /* Adjust sidebar */
    .kyc-sidebar .nav-link {
        font-size: 0.9rem;
    }

    /* Mobile verification steps */
    .verification-steps-mobile {
        padding: 25px 20px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .step-label {
        font-size: 0.8rem;
    }

    .btn-prev, .btn-next {
        padding: 12px 20px;
        font-size: 1rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .kyc-sidebar .nav-link {
        font-size: 0.95rem;
    }

    /* Progress steps */
    .progress-steps {
        padding: 25px 0;
    }

    .progress-step .circle {
        width: 45px;
        height: 45px;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    /* Reset any mobile-specific styles that shouldn't apply to desktop */
    .kyc-sidebar {
        border-right: 1px solid #eee;
        padding-right: 20px;
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    .kyc-sidebar .nav {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .kyc-sidebar .nav-link {
        flex: none;
        text-align: left;
        font-size: 1rem;
    }

    /* Show the progress line on desktop */
    .progress-steps::before {
        display: block;
    }

    /* Reset progress container for desktop */
    .progress-container {
        overflow-x: visible;
        padding: 0;
    }

    .progress-steps {
        min-width: auto;
        width: 100%;
        gap: 0;
        padding: 25px 0;
    }

    .progress-step {
        flex: 1;
        min-width: auto;
        padding: 0 15px;
    }

    /* Hide mobile verification steps on desktop */
    .verification-steps-mobile {
        display: none !important;
    }
}

/* Touch device specific improvements */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Adjust form controls for better touch experience */
    .form-control, .form-select {
        min-height: 44px;
    }

    /* Improve focus states for touch devices */
    .form-control:focus, .form-select:focus, .btn:focus {
        outline: 2px solid #008080;
        outline-offset: 2px;
    }

    /* Adjust links for better touch targets */
    a {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-custom-green {
        border: 2px solid #006666;
    }

    .btn-outline-custom-green {
        border-width: 2px;
    }

    .form-control, .form-select {
        border: 2px solid #ced4da;
    }

    .step-number {
        border: 2px solid #adb5bd;
    }

    .step.active .step-number {
        border: 2px solid #008080;
    }

    .step.completed .step-number {
        border: 2px solid #28a745;
    }
}

/* 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;
    }
}