/* ============================================
   ADMIN-MOBILE.CSS - Mobile Responsive for Admin/Helper Panels
   ============================================ */

/* === Base Mobile Adjustments === */
@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr !important;
    }

    .sidebar {
        position: fixed !important;
        left: -100% !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        z-index: 1000 !important;
        transition: left 0.3s ease !important;
    }

    .sidebar.open {
        left: 0 !important;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 15px 20px;
        background: rgba(20, 15, 45, 0.95);
        border-bottom: 1px solid rgba(168, 85, 247, 0.2);
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .hamburger-btn {
        background: rgba(168, 85, 247, 0.1);
        border: 1px solid rgba(168, 85, 247, 0.3);
        color: #c084fc;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .hamburger-btn:hover {
        background: rgba(168, 85, 247, 0.2);
        transform: scale(1.05);
    }

    .main-content {
        padding: 20px !important;
    }

    .section-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .section-header h1 {
        font-size: 1.6rem !important;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
        gap: 15px !important;
    }

    .stat-card {
        padding: 20px !important;
    }

    .stat-card i {
        font-size: 2rem !important;
    }

    .stat-card h2 {
        font-size: 2rem !important;
    }

    .stat-card p {
        font-size: 0.7rem !important;
    }

    .glass-card {
        padding: 20px !important;
    }
}

/* === Tablet === */
@media (max-width: 768px) {
    .chat-container {
        grid-template-columns: 1fr !important;
        height: calc(100vh - 150px) !important;
    }

    .chat-sidebar {
        position: absolute !important;
        left: -100% !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        z-index: 10 !important;
        background: rgba(15, 15, 35, 0.98) !important;
        transition: left 0.3s ease !important;
    }

    .chat-sidebar.open {
        left: 0 !important;
    }

    .chat-main {
        display: flex !important;
    }

    .helpersGrid,
    #helpersGrid,
    #usersGrid,
    #portfoliosGrid {
        grid-template-columns: 1fr !important;
    }

    .form-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .form-row input {
        max-width: 100% !important;
    }

    .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .nav-items {
        gap: 4px !important;
    }

    .nav-item {
        padding: 10px 15px !important;
        font-size: 0.9rem !important;
    }

    .nav-item i {
        font-size: 1rem !important;
    }
}

/* === Mobile Small === */
@media (max-width: 480px) {
    .main-content {
        padding: 15px !important;
    }

    .section-header h1 {
        font-size: 1.4rem !important;
    }

    .section-header p {
        font-size: 0.8rem !important;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .stat-card {
        padding: 15px !important;
    }

    .stat-card i {
        font-size: 1.5rem !important;
        margin-bottom: 10px !important;
    }

    .stat-card h2 {
        font-size: 1.5rem !important;
    }

    .stat-card p {
        font-size: 0.6rem !important;
        letter-spacing: 0.5px !important;
    }

    .glass-card {
        padding: 15px !important;
        border-radius: 16px !important;
    }

    .brand {
        font-size: 1.4rem !important;
    }

    .admin-profile {
        padding: 12px !important;
    }

    .admin-avatar {
        width: 40px !important;
        height: 40px !important;
    }

    .admin-info h4 {
        font-size: 0.9rem !important;
    }

    .admin-info p {
        font-size: 0.7rem !important;
    }

    .chat-input-area {
        padding: 12px !important;
    }

    .chat-input-area .glass-input {
        padding: 10px 14px !important;
        font-size: 0.9rem !important;
    }

    .btn-icon {
        width: 40px !important;
        height: 40px !important;
    }

    .msg-bubble {
        max-width: 85% !important;
        padding: 10px 14px !important;
        font-size: 0.9rem !important;
    }

    /* Checkbox groups on mobile */
    .checkbox-group {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }

    /* Tabs on mobile */
    .tab-content {
        animation: none !important;
    }
}

/* === Helper Sidebar Toggle for Mobile === */
@media (max-width: 900px) {

    .helper-layout .support-sidebar,
    .helper-sidebar,
    #supportSide {
        position: fixed !important;
        left: -100% !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 280px !important;
        z-index: 1000 !important;
        transition: left 0.3s ease !important;
        background: rgba(15, 15, 35, 0.98) !important;
    }

    .helper-layout .support-sidebar.open,
    .helper-sidebar.open,
    #supportSide.open {
        left: 0 !important;
    }
}

/* === Landscape Phone === */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        padding: 15px !important;
    }

    .brand {
        font-size: 1.2rem !important;
        margin-bottom: 10px !important;
    }

    .admin-profile {
        padding: 10px !important;
        margin-bottom: 10px !important;
    }

    .nav-item {
        padding: 8px 12px !important;
    }

    .logout-btn {
        padding: 10px !important;
    }
}

/* === Touch Improvements === */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .nav-item,
    .glass-card,
    .stat-card {
        transition: transform 0.2s ease !important;
    }

    .btn:active,
    .nav-item:active {
        transform: scale(0.98) !important;
    }

    .glass-card:hover,
    .stat-card:hover {
        transform: none !important;
    }

    /* Larger touch targets */
    .btn {
        min-height: 44px !important;
    }

    .checkbox-group input {
        width: 22px !important;
        height: 22px !important;
    }
}

/* === Dark Mode Scrollbar for Mobile === */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    ::-webkit-scrollbar-thumb {
        background: rgba(168, 85, 247, 0.3);
        border-radius: 2px;
    }
}

/* === Safe Area (for notched phones) === */
@supports (padding-top: env(safe-area-inset-top)) {
    .mobile-header {
        padding-top: calc(15px + env(safe-area-inset-top));
    }

    .sidebar {
        padding-top: calc(30px + env(safe-area-inset-top));
    }

    .chat-input-area {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}