/**
 * Mobile & Adaptive Styles
 * Адаптивные стили для мобильных устройств
 */

/* ===== MOBILE TAB BAR ===== */
.mobile-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-tab-bar-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 100%;
}

.mobile-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    max-width: 80px;
}

.mobile-tab-item-icon {
    font-size: 24px;
}

.mobile-tab-item-label {
    font-size: 11px;
    font-weight: 500;
}

.mobile-tab-item.active {
    color: #3b82f6;
}

.mobile-tab-item.active .mobile-tab-item-icon {
    transform: scale(1.1);
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet and below */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 240px !important;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Hide sidebar on mobile */
    .admin-sidebar {
        display: none !important;
    }

    /* Show mobile tab bar */
    .mobile-tab-bar {
        display: block !important;
    }

    /* Adjust content for tab bar */
    .admin-content {
        padding: 16px !important;
        padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
    }

    /* Adjust layout */
    .admin-layout {
        flex-direction: column !important;
    }

    /* Full width content */
    .admin-content {
        width: 100% !important;
    }

    /* Adjust header */
    .sidebar-header h2 {
        font-size: 18px !important;
    }

    /* Stats grid - 1 column on mobile */
    .admin-dashboard > div:first-of-type {
        grid-template-columns: 1fr !important;
    }

    /* Adjust card padding */
    .admin-dashboard > div > div {
        padding: 20px !important;
    }

    /* Adjust font sizes */
    .admin-dashboard h1 {
        font-size: 24px !important;
    }

    .admin-dashboard h2 {
        font-size: 16px !important;
    }

    /* Adjust quick actions */
    .quick-action-btn {
        padding: 16px !important;
    }

    /* Adjust table on mobile */
    .data-table {
        font-size: 14px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px !important;
    }

    /* Hide some columns on mobile */
    .data-table th:nth-child(n+4),
    .data-table td:nth-child(n+4) {
        display: none;
    }

    /* Stack forms on mobile */
    .form-row {
        flex-direction: column !important;
    }

    .form-row > * {
        width: 100% !important;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .admin-content {
        padding: 12px !important;
    }

    .mobile-tab-item-label {
        font-size: 10px;
    }

    .mobile-tab-item-icon {
        font-size: 22px;
    }

    /* 2 columns max on very small screens */
    .admin-dashboard > div:nth-of-type(4) > div,
    .admin-dashboard > div:nth-of-type(5) > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== PWA SAFE AREAS ===== */
@supports (padding: max(0px)) {
    .mobile-tab-bar {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .admin-content {
        padding-bottom: max(16px, calc(60px + env(safe-area-inset-bottom)));
    }
}

/* ===== LANDSCAPE MODE ===== */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-tab-bar {
        padding: 4px 0 max(4px, env(safe-area-inset-bottom));
    }

    .mobile-tab-item {
        padding: 6px 12px;
    }

    .mobile-tab-item-icon {
        font-size: 20px;
    }

    .mobile-tab-item-label {
        font-size: 10px;
    }
}

/* ===== DESKTOP ONLY ===== */
@media (min-width: 769px) {
    .mobile-tab-bar {
        display: none !important;
    }

    .admin-sidebar {
        display: block !important;
    }
}
