/* ============================================
   MOBILE OPTIMIZATION - DIGAMS
   ============================================ */

/* Mobile-specific improvements for better UX */

/* ============================================
   1. HEADER & NAVIGATION FIXES
   ============================================ */

@media (max-width: 768px) {
    /* Header adjustments */
    header {
        padding: 10px 15px !important;
        height: auto;
        min-height: 60px;
    }

    header .header-nav,
    header .header-right,
    header .header-actions,
    header .menu-toggle {
        display: none !important;
    }

    .logo {
        font-size: 1.1rem !important;
        gap: 8px !important;
    }

    .logo img {
        height: 32px !important;
    }

    /* Bottom navigation improvements */
    .bottom-nav {
        display: block !important;
        padding: 0.5rem 0 0.6rem;
        background-color: #ffffff;
        box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.12);
        border-top: 2px solid #e9ecef;
    }

    .bottom-nav ul {
        display: flex;
        justify-content: space-around;
        align-items: center;
        list-style: none;
        padding: 0;
        margin: 0;
        max-width: 100%;
    }

    .bottom-nav li {
        flex: 1;
        text-align: center;
    }

    .bottom-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        padding: 0.4rem 0.2rem;
        color: #6c757d;
        text-decoration: none;
        transition: all 0.2s ease;
        border-radius: 8px;
        min-height: 50px;
        justify-content: center;
    }

    .bottom-nav a:active,
    .bottom-nav a.active {
        color: #FF8C00;
        background-color: rgba(255, 140, 0, 0.08);
    }

    .bottom-nav a i {
        font-size: 1.4rem;
        color: inherit;
        transition: all 0.2s ease;
    }

    .bottom-nav a span {
        font-size: 0.65rem;
        font-weight: 600;
        margin-top: 0.1rem;
    }

    /* Main content spacing for bottom nav */
    .main-content {
        margin-top: 65px !important;
        padding: 1rem 0.75rem !important;
        padding-bottom: 5.5rem !important;
    }
}

/* ============================================
   2. FORM OPTIMIZATION (Login/Signup)
   ============================================ */

@media (max-width: 768px) {
    /* Auth layout improvements */
    .auth-layout {
        min-height: 100vh;
        padding: 0;
    }

    .auth-main {
        min-height: 100vh;
        padding: 1rem 0.75rem !important;
        display: flex;
        align-items: flex-start;
    }

    .auth-container {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .auth-wrapper {
        min-height: auto !important;
        padding: 0;
        align-items: flex-start;
    }

    /* Login/Signup card optimization */
    .login-page .login-card,
    .signup-page .signup-card,
    .auth-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.5rem 1.25rem !important;
        border-radius: 16px !important;
        margin: 0;
        box-shadow: 0 8px 20px rgba(3, 43, 68, 0.1) !important;
    }

    /* Badge size reduction */
    .login-page .login-badge,
    .signup-page .login-badge {
        width: 45px !important;
        height: 45px !important;
        margin: 0 auto 0.75rem !important;
    }

    .login-page .login-badge i,
    .signup-page .login-badge i {
        font-size: 1.3rem;
    }

    /* Title optimization */
    .auth-title,
    .login-page .auth-title,
    .signup-page .auth-title {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
        text-align: center;
    }

    /* Subtitle optimization */
    .login-page .login-subtitle,
    .signup-page .login-subtitle {
        font-size: 0.875rem !important;
        margin: 0 0 1.25rem !important;
        line-height: 1.4;
    }

    /* Form group spacing */
    .auth-wrapper .form-group,
    .login-page .form-group,
    .signup-page .form-group {
        margin-bottom: 1rem !important;
    }

    /* Label optimization */
    .auth-wrapper .form-group label,
    .login-page .form-group label,
    .signup-page .form-group label {
        font-size: 0.875rem !important;
        margin-bottom: 0.4rem !important;
    }

    /* Input field optimization */
    .auth-wrapper .form-group input,
    .auth-wrapper .form-group select,
    .auth-wrapper .form-group textarea,
    .login-page .form-group input,
    .signup-page .form-group input,
    .signup-page .form-group select,
    .signup-page .form-group textarea {
        min-height: 46px !important;
        padding: 10px 12px !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
    }

    /* Button optimization */
    .auth-wrapper .btn-submit,
    .login-page .login-submit,
    .signup-page .signup-submit {
        min-height: 48px !important;
        padding: 12px 20px !important;
        font-size: 0.95rem !important;
        border-radius: 10px !important;
    }

    /* Form actions */
    .auth-wrapper .form-actions,
    .login-page .form-actions,
    .signup-page .form-actions {
        margin-top: 1rem !important;
    }

    /* Footer links */
    .auth-footer {
        margin-top: 1rem !important;
        font-size: 0.875rem !important;
    }

    /* Password toggle button */
    .auth-password .password-toggle {
        right: 10px !important;
        padding: 8px !important;
    }

    /* Error messages */
    .error-message,
    .field-error {
        font-size: 0.8rem !important;
        margin-top: 0.3rem !important;
    }

    /* Two-column form to single column on mobile */
    .app-content form .form-row,
    .app-content .form-section {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .app-content .form-section {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .app-content .form-section .section-title {
        font-size: 1rem !important;
        margin-bottom: 0.75rem !important;
    }

    .app-content .form-actions {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }


/* Extra-tight spacing for very small phones */
@media (max-width: 480px) {
    .auth-main {
        padding: 0.75rem 0.6rem !important;
    }

    .login-page .login-card,
    .signup-page .signup-card,
    .auth-card {
        padding: 1.25rem 1rem !important;
        border-radius: 14px !important;
    }

    .auth-title,
    .login-page .auth-title,
    .signup-page .auth-title {
        font-size: 1.35rem !important;
    }

    .login-page .login-subtitle,
    .signup-page .login-subtitle {
        margin-bottom: 1rem !important;
    }

    .auth-wrapper .form-group,
    .login-page .form-group,
    .signup-page .form-group {
        margin-bottom: 0.85rem !important;
    }

    .auth-wrapper .form-group input,
    .auth-wrapper .form-group select,
    .auth-wrapper .form-group textarea,
    .login-page .form-group input,
    .signup-page .form-group input,
    .signup-page .form-group select,
    .signup-page .form-group textarea {
        min-height: 44px !important;
        padding: 9px 11px !important;
        font-size: 0.95rem !important;
    }
}
    .app-content .form-actions button,
    .app-content .form-actions a {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ============================================
   3. TABLE OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Table container */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }

    .table-container table {
        font-size: 0.8rem !important;
        min-width: 700px;
    }

    .table-container thead th {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }

    .table-container tbody td {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.8rem !important;
    }

    /* Patient info column */
    .patient-info {
        min-width: 140px !important;
    }

    .patient-name {
        font-size: 0.85rem !important;
    }

    .order-number {
        font-size: 0.75rem !important;
    }

    /* Details column */
    .details-column {
        min-width: 300px !important;
    }

    .section-title {
        font-size: 0.8rem !important;
        margin-bottom: 0.5rem !important;
        margin-top: 0.75rem !important;
    }

    .section-title:first-child {
        margin-top: 0 !important;
    }

    .test-list,
    .panel-list {
        gap: 0.5rem !important;
    }

    .test-item,
    .panel-item {
        padding: 0.6rem !important;
    }

    .test-name {
        font-size: 0.8rem !important;
        line-height: 1.3;
    }

    .test-price {
        font-size: 0.75rem !important;
    }

    .status-badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.5rem !important;
    }

    .rejection-reason,
    .result-display {
        font-size: 0.7rem !important;
        padding: 0.4rem !important;
        margin-top: 0.4rem !important;
    }

    /* Sample status column */
    .sample-status-column {
        min-width: 150px !important;
    }

    .sample-list {
        gap: 0.5rem !important;
    }

    .sample-item {
        padding: 0.5rem !important;
        font-size: 0.75rem !important;
    }

    .sample-type {
        font-size: 0.75rem !important;
    }

    /* Order date column */
    .order-date {
        min-width: 100px !important;
        font-size: 0.8rem !important;
    }
}

/* ============================================
   4. CARD & CONTENT OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    /* Page title */
    .page-title {
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
        text-align: center;
    }

    /* Card styling */
    .card {
        margin-bottom: 1rem !important;
        border-radius: 12px !important;
    }

    .card-header {
        padding: 1rem 1.25rem !important;
        flex-wrap: wrap;
    }

    .card-header h2 {
        font-size: 1rem !important;
    }

    .card-header i {
        font-size: 1.1rem !important;
    }

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

    /* Filter form */
    .filter-form {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    .filter-form .form-group {
        width: 100% !important;
        min-width: 100% !important;
    }

    .filter-form button {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Breadcrumb */
    .breadcrumb {
        padding: 0.75rem 1rem !important;
        margin-bottom: 1rem !important;
        font-size: 0.85rem !important;
    }

    .breadcrumb nav {
        flex-wrap: wrap;
    }

    /* Icon grid */
    .icon-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    .icon-button {
        padding: 1.25rem 0.75rem !important;
    }

    .icon-button i {
        font-size: 2rem !important;
        margin-bottom: 0.75rem !important;
    }

    .icon-button span {
        font-size: 0.875rem !important;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem !important;
        padding: 1rem 0 !important;
    }

    .pagination a,
    .pagination span {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
    }

    /* Empty state */
    .empty-state {
        padding: 2rem 1rem !important;
    }

    .empty-state i {
        font-size: 2.5rem !important;
    }

    .empty-state h3 {
        font-size: 1rem !important;
    }

    .empty-state p {
        font-size: 0.85rem !important;
    }
}

/* ============================================
   5. TOAST NOTIFICATIONS
   ============================================ */

@media (max-width: 768px) {
    .toast-container {
        top: 65px !important;
        right: 0.75rem !important;
        left: 0.75rem !important;
        max-width: none !important;
    }

    .toast {
        min-width: initial !important;
        width: 100% !important;
        padding: 12px 14px !important;
    }

    .toast-icon {
        font-size: 1.1rem !important;
    }

    .toast-content {
        font-size: 0.85rem !important;
    }
}

/* ============================================
   6. FOOTER OPTIMIZATION
   ============================================ */

@media (max-width: 768px) {
    footer {
        padding: 2.5rem 1rem 1rem !important;
        margin-top: 2rem !important;
        margin-bottom: 4rem !important;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .footer-column h3 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
    }

    .footer-column ul li {
        margin-bottom: 0.75rem !important;
    }

    .footer-column a {
        font-size: 0.9rem !important;
    }

    .subscribe-form {
        flex-direction: column !important;
    }

    .subscribe-form input {
        border-radius: 10px !important;
        margin-bottom: 0.5rem !important;
    }

    .subscribe-form button {
        border-radius: 10px !important;
        padding: 12px 20px !important;
    }

    .footer-bottom {
        flex-direction: column !important;
        gap: 1.25rem !important;
        text-align: center !important;
        font-size: 0.85rem !important;
    }

    .social-links {
        gap: 1rem !important;
    }

    .social-links a {
        width: 40px !important;
        height: 40px !important;
        font-size: 1.1rem !important;
    }
}

/* ============================================
   7. TOUCH IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Increase touch target sizes */
    button,
    a,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Improve tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(255, 140, 0, 0.2);
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }

    /* Prevent text size adjustment */
    body {
        -webkit-text-size-adjust: 100%;
        -moz-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* ============================================
   8. LANDSCAPE MODE OPTIMIZATION
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .auth-main {
        padding: 0.75rem !important;
    }

    .login-page .login-card,
    .signup-page .signup-card {
        padding: 1.25rem 1rem !important;
    }

    .main-content {
        padding: 0.75rem !important;
    }
}

/* ============================================
   9. SMALL MOBILE DEVICES (< 375px)
   ============================================ */

@media (max-width: 375px) {
    .logo {
        font-size: 1rem !important;
    }

    .logo img {
        height: 28px !important;
    }

    .page-title {
        font-size: 1.5rem !important;
    }

    .card-header h2 {
        font-size: 0.95rem !important;
    }

    .bottom-nav a span {
        font-size: 0.6rem !important;
    }

    .bottom-nav a i {
        font-size: 1.3rem !important;
    }

    .icon-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   10. HOME PAGE - FEATURES VISUAL FIX
   ============================================ */

@media (max-width: 768px) {
    /* Features visual card - better image visibility */
    .features-visual-card {
        min-height: 500px !important;
    }

    .features-visual-card img {
        min-height: 500px !important;
        object-fit: cover;
        object-position: center;
    }

    /* Text overlay - reduce size and reposition */
    .features-visual-copy {
        left: 16px !important;
        right: 16px !important;
        bottom: 16px !important;
        padding: 16px 18px !important;
        background: rgba(3, 43, 68, 0.85) !important;
        backdrop-filter: blur(10px) !important;
    }

    .features-visual-copy span {
        padding: 6px 12px !important;
        font-size: 0.7rem !important;
        gap: 6px !important;
    }

    .features-visual-copy span i {
        font-size: 0.85rem !important;
    }

    .features-visual-copy h3 {
        font-size: 1.25rem !important;
        margin: 12px 0 8px !important;
        line-height: 1.25 !important;
    }

    .features-visual-copy p {
        font-size: 0.85rem !important;
        line-height: 1.5 !important;
        margin: 0 !important;
    }
}

@media (max-width: 480px) {
    /* Even smaller screens - more compact overlay */
    .features-visual-card {
        min-height: 450px !important;
        border-radius: 20px !important;
    }

    .features-visual-card img {
        min-height: 450px !important;
    }

    .features-visual-copy {
        left: 12px !important;
        right: 12px !important;
        bottom: 12px !important;
        padding: 14px 16px !important;
        border-radius: 16px !important;
    }

    .features-visual-copy span {
        padding: 5px 10px !important;
        font-size: 0.65rem !important;
    }

    .features-visual-copy h3 {
        font-size: 1.1rem !important;
        margin: 10px 0 6px !important;
    }

    .features-visual-copy p {
        font-size: 0.8rem !important;
        line-height: 1.45 !important;
    }
}

@media (max-width: 375px) {
    /* Very small screens - minimal overlay */
    .features-visual-card {
        min-height: 420px !important;
    }

    .features-visual-card img {
        min-height: 420px !important;
    }

    .features-visual-copy {
        padding: 12px 14px !important;
    }

    .features-visual-copy h3 {
        font-size: 1rem !important;
        margin: 8px 0 6px !important;
    }

    .features-visual-copy p {
        font-size: 0.75rem !important;
        line-height: 1.4 !important;
    }
}
