/* Lawyer Dashboard - Mobile Only Optimizations */
/* This CSS ONLY applies to mobile devices and preserves desktop layout */

/* Only apply these styles on mobile devices (max-width: 767px) */
@media only screen and (max-width: 767px) {

    /* Make the page responsive without breaking layout */
    body.page-id-1155 {
        overflow-x: hidden;
    }

    /* FORCE ALL SECTIONS TO STACK VERTICALLY */
    body.page-id-1155 .elementor-section .elementor-container,
    body.page-id-1155 .elementor-section .elementor-row,
    body.page-id-1155 .elementor-container,
    body.page-id-1155 .elementor-row {
        flex-direction: column !important;
        align-items: center !important;
        display: flex !important;
    }

    /* Make ALL columns full width and stack */
    body.page-id-1155 .elementor-column,
    body.page-id-1155 .elementor-col-50,
    body.page-id-1155 .elementor-col-33,
    body.page-id-1155 .elementor-col-25,
    body.page-id-1155 .elementor-col-66,
    body.page-id-1155 .elementor-col-75,
    body.page-id-1155 [class*="elementor-col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-bottom: 20px !important;
    }

    /* Remove any flex properties that might cause side-by-side layout */
    body.page-id-1155 .elementor-row {
        flex-wrap: wrap !important;
    }

    /* Specific fix for the Immigration Case Management box */
    body.page-id-1155 .elementor-widget:has(h3),
    body.page-id-1155 .elementor-widget-heading:has(h3) {
        width: 100% !important;
        display: block !important;
        margin-bottom: 15px !important;
    }

    /* Target the Welcome box specifically and put it below Immigration Case Management */
    body.page-id-1155 div[style*="linear-gradient(135deg, #667eea"],
    body.page-id-1155 div[style*="Welcome"] {
        width: 100% !important;
        display: block !important;
        order: 2 !important; /* Put it after Immigration Case Management */
        margin-top: 20px !important;
    }

    /* Animated logo container - center it */
    body.page-id-1155 #lottie-logo,
    body.page-id-1155 [id*="lottie"],
    body.page-id-1155 .logo-container {
        margin: 0 auto !important;
        display: block !important;
        max-width: 200px !important;
    }

    /* Immigration Case Management title - ensure it's at top and full width */
    body.page-id-1155 h3:first-of-type,
    body.page-id-1155 .elementor-widget-heading:first-of-type h3 {
        text-align: center !important;
        width: 100% !important;
        display: block !important;
        margin: 0 0 20px 0 !important;
        font-size: 20px !important;
        padding: 10px !important;
        background: #f8f9fa !important;
        border-radius: 5px !important;
    }

    /* Fix Welcome message - center under Immigration Case Management */
    body.page-id-1155 h1,
    body.page-id-1155 .elementor-widget-heading h1 {
        text-align: center !important;
        padding: 15px 10px !important;
        margin: 10px auto !important;
        width: 100% !important;
        font-size: 22px !important;
        word-wrap: break-word !important;
        display: block !important;
        float: none !important;
        clear: both !important;
    }

    /* immiPlus Dashboard text - center it */
    body.page-id-1155 h2,
    body.page-id-1155 .elementor-widget-heading h2 {
        text-align: center !important;
        width: 100% !important;
        margin: 0 auto 15px !important;
        font-size: 18px !important;
        clear: both !important;
    }

    /* Ensure proper stacking order */
    body.page-id-1155 .elementor-section:first-child {
        display: flex !important;
        flex-direction: column !important;
    }

    body.page-id-1155 .elementor-section:first-child .elementor-widget {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    /* Force the Welcome gradient box to be below Immigration Case Management */
    body.page-id-1155 div[style*="background: linear-gradient"] {
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
        margin: 20px auto !important;
        clear: both !important;
    }

    /* Ensure Immigration Case Management stays at top */
    body.page-id-1155 h3:contains("Immigration Case Management"),
    body.page-id-1155 .elementor-widget:has(h3:contains("Immigration Case Management")) {
        order: 1 !important;
    }

    /* Fix Logout button - make it a centered button */
    body.page-id-1155 a[href*="logout"],
    body.page-id-1155 .logout-button,
    body.page-id-1155 [class*="logout"] {
        position: static !important;
        float: none !important;
        display: block !important;
        width: auto !important;
        max-width: 200px !important;
        text-align: center !important;
        margin: 15px auto !important;
        padding: 10px 20px !important;
        background: #dc3545 !important;
        color: white !important;
        border-radius: 5px !important;
        text-decoration: none !important;
    }

    /* Ensure the first section (header area) uses full width */
    body.page-id-1155 > .elementor:first-child .elementor-section:first-child {
        padding: 20px 10px !important;
    }

    /* Force flexbox column layout for the header area */
    body.page-id-1155 .elementor-section:first-child .elementor-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
    }

    /* Specific fix: Move gradient Welcome box below Case Management */
    body.page-id-1155 .elementor-container > * {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Target the specific Welcome box and force it below */
    body.page-id-1155 div[style*="#667eea"],
    body.page-id-1155 div[style*="#764ba2"] {
        order: 10 !important; /* High order to ensure it's last */
        margin-top: 20px !important;
        width: 100% !important;
    }

    /* Ensure containers don't overflow */
    body.page-id-1155 .elementor-section,
    body.page-id-1155 .elementor-container,
    body.page-id-1155 .elementor-row,
    body.page-id-1155 .elementor-column {
        padding-left: 10px !important;
        padding-right: 10px !important;
        max-width: 100% !important;
    }

    /* Fix subscription box to contain Manage Subscription button */
    body.page-id-1155 .elementor-widget-container {
        overflow: visible !important;
        padding: 15px !important;
    }

    /* Fix View Plans and Manage Subscription buttons */
    body.page-id-1155 [href*="plan"],
    body.page-id-1155 [href*="pricing"],
    body.page-id-1155 .manage-subscription-btn {
        display: block !important;
        width: 100% !important;
        margin: 10px 0 !important;
        text-align: center !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    /* Ensure Manage Subscription button is inside the box */
    body.page-id-1155 .manage-subscription-btn {
        position: relative !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Fix unique application URL display */
    body.page-id-1155 [class*="application-link"],
    body.page-id-1155 [class*="unique-link"],
    body.page-id-1155 .application-link {
        word-break: break-all !important;
        font-size: 11px !important;
        line-height: 1.4 !important;
        padding: 10px !important;
        background: #f5f5f5 !important;
        border-radius: 5px !important;
        display: block !important;
        overflow-wrap: break-word !important;
    }

    /* Recent Applications Table - Convert to card layout on mobile */
    body.page-id-1155 table {
        border: none !important;
        background: transparent !important;
    }

    body.page-id-1155 thead {
        display: none !important; /* Hide table headers on mobile */
    }

    body.page-id-1155 tbody {
        display: block !important;
    }

    body.page-id-1155 tr {
        display: block !important;
        margin-bottom: 15px !important;
        background: white !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 8px !important;
        padding: 15px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }

    body.page-id-1155 td {
        display: block !important;
        text-align: left !important;
        padding: 8px 0 !important;
        border: none !important;
        position: relative !important;
        padding-left: 35% !important;
    }

    body.page-id-1155 td::before {
        content: attr(data-label);
        position: absolute !important;
        left: 0 !important;
        width: 30% !important;
        font-weight: bold !important;
        text-align: left !important;
        padding-left: 10px !important;
    }

    /* Style the first column (Application #) as a header */
    body.page-id-1155 td:first-child {
        background: #9B59D0 !important;
        color: white !important;
        padding: 10px !important;
        margin: -15px -15px 10px -15px !important;
        border-radius: 8px 8px 0 0 !important;
        text-align: center !important;
        font-weight: bold !important;
    }

    body.page-id-1155 td:first-child::before {
        content: "Application #" !important;
        position: relative !important;
        padding: 0 !important;
        width: auto !important;
    }

    /* Style the Actions column */
    body.page-id-1155 td:last-child {
        text-align: center !important;
        padding-left: 0 !important;
        margin-top: 10px !important;
        padding-top: 15px !important;
        border-top: 1px solid #e0e0e0 !important;
    }

    body.page-id-1155 td:last-child::before {
        display: none !important;
    }

    /* Style View Details button */
    body.page-id-1155 td:last-child a,
    body.page-id-1155 td:last-child button {
        display: inline-block !important;
        padding: 8px 20px !important;
        background: #9B59D0 !important;
        color: white !important;
        text-decoration: none !important;
        border-radius: 5px !important;
        font-size: 14px !important;
    }

    /* Make fonts slightly smaller for mobile readability */
    body.page-id-1155 h1 {
        font-size: 28px !important;
    }

    body.page-id-1155 h2 {
        font-size: 24px !important;
    }

    body.page-id-1155 h3 {
        font-size: 20px !important;
    }

    /* Stack columns vertically on mobile */
    body.page-id-1155 .elementor-column {
        width: 100% !important;
    }

    /* Make buttons full width on mobile */
    body.page-id-1155 .elementor-button,
    body.page-id-1155 button,
    body.page-id-1155 .button {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    /* Fix the Manage Subscription button positioning */
    body.page-id-1155 .manage-subscription-btn {
        margin-left: 0 !important;
        margin-top: 10px !important;
        display: block !important;
        width: 100% !important;
    }

    /* Make the application link readable */
    body.page-id-1155 .application-link,
    body.page-id-1155 [class*="unique-application-link"] {
        word-break: break-all !important;
        font-size: 12px !important;
    }

    /* Improve form inputs for mobile */
    body.page-id-1155 input,
    body.page-id-1155 select,
    body.page-id-1155 textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        max-width: 100% !important;
    }

    /* Stack subscription info better */
    body.page-id-1155 .elementor-widget-text-editor {
        padding: 10px !important;
    }

    /* Ensure images don't overflow */
    body.page-id-1155 img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Fix spacing between sections */
    body.page-id-1155 .elementor-widget {
        margin-bottom: 20px !important;
    }

    /* Make stats/counters stack nicely */
    body.page-id-1155 .elementor-counter {
        margin-bottom: 15px !important;
    }

    /* Ensure logout button is visible */
    body.page-id-1155 .logout-button,
    body.page-id-1155 a[href*="logout"] {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 10px !important;
        margin-top: 20px !important;
    }
}

/* Small mobile devices (max-width: 480px) */
@media only screen and (max-width: 480px) {

    /* Further reduce padding on very small screens */
    body.page-id-1155 .elementor-section,
    body.page-id-1155 .elementor-container {
        padding-left: 5px !important;
        padding-right: 5px !important;
    }

    /* Make table fonts smaller */
    body.page-id-1155 table {
        font-size: 12px !important;
    }

    body.page-id-1155 td,
    body.page-id-1155 th {
        padding: 5px !important;
    }

    /* Hide less important table columns */
    body.page-id-1155 table th:nth-child(5),
    body.page-id-1155 table td:nth-child(5) {
        display: none !important;
    }

    /* Stack all elements vertically */
    body.page-id-1155 .elementor-row {
        flex-direction: column !important;
    }

    /* Reduce heading sizes further */
    body.page-id-1155 h1 {
        font-size: 24px !important;
    }

    body.page-id-1155 h2 {
        font-size: 20px !important;
    }

    body.page-id-1155 h3 {
        font-size: 18px !important;
    }
}

/* Landscape mobile (height less than 500px) */
@media only screen and (max-height: 500px) and (orientation: landscape) {

    /* Reduce vertical spacing in landscape */
    body.page-id-1155 .elementor-widget {
        margin-bottom: 10px !important;
    }

    body.page-id-1155 .elementor-section {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
}

/* Touch device specific */
@media (hover: none) and (pointer: coarse) {

    /* Make clickable elements more touch-friendly */
    body.page-id-1155 a,
    body.page-id-1155 button {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
}

/* Fix for iOS specific issues */
@supports (-webkit-touch-callout: none) {

    /* Prevent iOS zoom on form focus */
    body.page-id-1155 input[type="text"],
    body.page-id-1155 input[type="email"],
    body.page-id-1155 input[type="password"],
    body.page-id-1155 select,
    body.page-id-1155 textarea {
        font-size: 16px !important;
    }

    /* Fix iOS scrolling */
    body.page-id-1155 .table-wrapper,
    body.page-id-1155 table {
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Ensure desktop remains unchanged - explicitly preserve desktop styles */
@media only screen and (min-width: 768px) {
    /* This ensures nothing changes on desktop */
    body.page-id-1155 * {
        /* Desktop styles remain as-is */
    }
}