/* Global Mobile Responsive Styles for WSAV Application */

/* Base mobile styles */
@media (max-width: 576px) {

    /* Typography improvements */
    body {
        font-size: 14px;
        line-height: 1.5;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    h6 {
        font-size: 0.9rem;
    }

    /* Container and spacing improvements */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Card improvements */
    .card {
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    /* Button improvements */
    .btn {
        min-width: 44px;
        min-height: 44px;
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }

    .btn-sm {
        min-width: 36px;
        min-height: 36px;
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }

    /* Form improvements */
    .form-control {
        min-height: 44px;
        font-size: 1rem;
        padding: 0.5rem 0.75rem;
    }

    .form-control-sm {
        min-height: 36px;
        font-size: 0.9rem;
    }

    .form-label {
        font-size: 0.9rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }

    /* Table improvements */
    .table-responsive {
        font-size: 0.85rem;
    }

    .table td,
    .table th {
        padding: 0.5rem 0.25rem;
        vertical-align: middle;
    }

    /* Modal improvements */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    /* Alert improvements */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
        border-radius: 6px;
    }

    /* Navigation improvements */
    .navbar-nav .nav-item {
        margin-bottom: 0.5rem;
    }

    /* Dropdown improvements */
    .dropdown-menu {
        font-size: 0.9rem;
        max-height: 300px;
        overflow-y: auto;
    }

    /* Grid improvements */
    .row.g-3>* {
        padding: 0.5rem;
    }

    .row.g-2>* {
        padding: 0.25rem;
    }

    /* Utility class improvements */
    .mb-3 {
        margin-bottom: 1rem !important;
    }

    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
}

/* Tablet styles (577px to 991px) */
@media (min-width: 577px) and (max-width: 991px) {
    body {
        font-size: 15px;
    }

    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .btn {
        min-height: 40px;
        font-size: 0.95rem;
    }

    .form-control {
        min-height: 40px;
        font-size: 0.95rem;
    }

    .table-responsive {
        font-size: 0.9rem;
    }

    .modal-dialog {
        margin: 1rem;
    }
}

/* Large mobile landscape styles (481px to 576px) */
@media (min-width: 481px) and (max-width: 576px) {
    .card-body {
        padding: 1.125rem;
    }

    .btn {
        font-size: 0.925rem;
    }

    .form-control {
        font-size: 0.95rem;
    }
}

/* Extra small mobile styles (up to 480px) */
@media (max-width: 480px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }

    .form-control {
        font-size: 0.9rem;
    }

    .table td,
    .table th {
        padding: 0.375rem 0.25rem;
        font-size: 0.8rem;
    }

    .modal-dialog {
        margin: 0.25rem;
    }

    .modal-body {
        padding: 0.75rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

    /* This targets touch devices */
    .btn,
    .form-control,
    .nav-link,
    .dropdown-item,
    [role="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Increase tap targets */
    .table td a,
    .table td button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }
}

/* Landscape mobile orientation */
@media (max-width: 991px) and (orientation: landscape) {
    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-body {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Focus improvements for accessibility */
@media (max-width: 991px) {

    .form-control:focus,
    .btn:focus,
    .nav-link:focus,
    .dropdown-item:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
}

/* Loading states for mobile */
@media (max-width: 576px) {
    .btn.loading {
        pointer-events: none;
        opacity: 0.6;
    }

    .btn.loading::after {
        content: '';
        width: 16px;
        height: 16px;
        margin-left: 8px;
        border: 2px solid transparent;
        border-top: 2px solid currentColor;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        display: inline-block;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Dark mode support for mobile */
@media (max-width: 991px) and (prefers-color-scheme: dark) {
    .card {
        background-color: #2d3748;
        border-color: #4a5568;
    }

    .form-control {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .form-control:focus {
        background-color: #2d3748;
        border-color: #007bff;
        color: #e2e8f0;
    }
}

/* Print styles for mobile */
@media print {

    .btn,
    .navbar,
    .sidebar,
    .offcanvas,
    .modal,
    .dropdown-menu {
        display: none !important;
    }

    .container-fluid {
        width: 100% !important;
        max-width: none !important;
        padding: 0 !important;
    }

    .card {
        border: 1px solid #dee2e6 !important;
        box-shadow: none !important;
    }
}
