/* Responsive Utilities & Telegram Mini App Adaptations */

/* Tablet & Mobile Layout Shifts */
@media (max-width: 1024px) {
    body {
        padding: var(--spacing-md);
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: stretch;
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
    }

    .brand {
        justify-content: center;
    }

    .search-container {
        max-width: 100%;
        width: 100%;
    }

    .actions-group {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }

    .controls-panel {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    .filter-section {
        width: 100%;
        justify-content: space-between;
    }

    .pill-group {
        overflow-x: auto;
        padding-bottom: 4px;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    .filter-pill {
        flex-shrink: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Telegram Mini App & Small Viewports (xs) */
@media (max-width: 480px) {
    body {
        padding: var(--spacing-sm);
        /* Safe bottom spacing for Telegram bottom buttons or dynamic height bounds */
        padding-bottom: calc(var(--spacing-xl) + 16px);
    }

    h1, h2, h3, h4 {
        letter-spacing: -0.1px;
    }

    .directory-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .employee-card {
        padding: var(--spacing-sm);
    }

    /* Modal adjustments for mobile */
    .modal-container {
        padding: var(--spacing-md);
        margin: var(--spacing-sm);
        max-height: 95vh;
    }

    .modal-details-grid {
        grid-template-columns: 1fr;
    }

    /* Target inputs for mobile touch (larger touch targets) */
    .form-control, .dropdown-select {
        padding: 12px;
        font-size: 15px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 15px;
        min-height: 44px; /* WCAG minimum touch target size */
    }

    /* Mobile specific adjustments to FAB order button */
    .frap-btn {
        bottom: 16px;
        right: 16px;
        width: 50px;
        height: 50px;
    }
}

/* TMA specific styles when body has .tma-mode */
body.tma-mode {
    border-radius: 0;
    margin: 0;
    padding: var(--spacing-sm);
}

body.tma-mode .app-container {
    max-width: 100%;
}

body.tma-mode .main-panel {
    border-radius: 8px;
    box-shadow: none; /* Keep flat inside Telegram Mini App */
}
