/* ========================================================================
   MOBILE OPTIMIZATION CSS
   ======================================================================== */

@media (max-width: 768px) {

    /* Sidebar Mobile */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        overflow-y: auto;
    }

    .sidebar.active {
        left: 0;
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #007bff;
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 998;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
    }

    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }

    /* Content Adjustments */
    .tool-container {
        padding: 1rem !important;
    }

    .p-5 {
        padding: 1.5rem !important;
    }

    /* Touch-Friendly Inputs */
    input,
    select,
    textarea,
    button {
        min-height: 44px;
        /* iOS touch target minimum */
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .form-control,
    .form-control-lg {
        font-size: 16px;
        padding: 0.75rem;
    }

    .btn {
        min-height: 44px;
        padding: 0.75rem 1.5rem;
    }

    .btn-lg {
        min-height: 48px;
        padding: 1rem 2rem;
    }

    /* Tables */
    .table-responsive {
        font-size: 0.875rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .modal-xl {
        max-width: calc(100% - 1rem);
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Headers */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Buttons Group */
    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Spacing */
    .mb-4 {
        margin-bottom: 1rem !important;
    }

    .mt-4 {
        margin-top: 1rem !important;
    }

    /* Grid Adjustments */
    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .col,
    [class*="col-"] {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* Tablet Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .tool-container {
        padding: 2rem !important;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        width: 240px;
    }

    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Small Mobile (< 375px) */
@media (max-width: 374px) {
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .table {
        font-size: 0.75rem;
    }
}