/* ========================================
   WORKPASS 2.0 - RESPONSIVE DESIGN
   Adapts layout for mobile, tablet, desktop
   ======================================== */

/* ============ TABLET (max-width: 1024px) ============ */
@media (max-width: 1024px) {

    /* Dashboard content padding */
    .dashboard-content {
        padding: 30px 30px 100px 30px;
    }

    /* Grid to 2 columns */
    .dashboard-grid {
        column-count: 2;
    }

    /* Tasks grid smaller */
    .tasks-list.grid-layout {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
}

/* ============ MOBILE (max-width: 768px) ============ */
@media (max-width: 768px) {

    /* ---- HERO / LOGIN CARD ---- */
    .workpass-view {
        padding: 20px 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .wp-card-premium {
        max-width: 100%;
        padding: 32px 24px;
        border-radius: 28px;
        aspect-ratio: auto;
        /* Remove fixed aspect ratio on mobile */
    }

    .wp-card-premium:hover {
        transform: none;
        /* Disable hover tilt on touch */
    }

    .workpass-title {
        font-size: 32px;
    }

    .workpass-description {
        font-size: 14px;
    }

    .workpass-avatar-container {
        width: 64px;
        height: 64px;
    }

    .wp-card-actions {
        gap: 8px;
        padding: 8px;
    }

    .card-action-btn {
        padding: 8px;
        font-size: 16px;
    }

    .card-action-btn i {
        width: 18px;
        height: 18px;
    }

    /* ---- AUTH MODAL ---- */
    .auth-modal-content {
        padding: 2rem 1.5rem;
        border-radius: 24px;
        width: 95%;
        max-width: 100%;
    }

    .auth-logo {
        width: 60px;
    }

    /* ---- SIDEBAR → BOTTOM NAV ---- */
    .sidebar-trigger {
        display: none;
    }

    .dashboard-sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        transform: translateX(0);
        /* Always visible */
        pointer-events: auto;
        flex-direction: row;
        padding: 0;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        z-index: 200;
    }

    .sidebar-trigger:hover+.dashboard-sidebar,
    .dashboard-sidebar:hover {
        transform: translateX(0);
        transition-delay: 0s;
    }

    .sidebar-header {
        display: none;
        /* Hide logo on mobile bottom nav */
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 0;
        width: 100%;
        justify-content: space-around;
        padding: 8px 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-divider {
        display: none !important;
    }

    .nav-item {
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 6px;
        font-size: 10px;
        min-width: 52px;
        border-radius: 8px;
        white-space: nowrap;
    }

    .nav-icon {
        font-size: 20px;
    }

    /* ---- DASHBOARD CONTENT ---- */
    .dashboard-content {
        padding: 20px 16px 100px 16px;
        /* Extra bottom padding for nav bar */
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .dashboard-header h2 {
        font-size: 22px;
    }

    /* ---- GRID LAYOUT ---- */
    .dashboard-grid {
        column-count: 1;
        gap: 12px;
    }

    .dashboard-card {
        border-radius: 20px;
    }

    /* ---- XP BAR ---- */
    .xp-details {
        flex-direction: column;
        gap: 4px;
    }

    .xp-text {
        font-size: 12px;
    }

    /* ---- TASK CARDS ---- */
    .tasks-list.grid-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .task-card {
        border-radius: 16px;
    }

    /* ---- CHAT ---- */
    .chat-enhanced {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        height: calc(100vh - 200px);
    }

    .channel-sidebar {
        grid-column: 1;
        grid-row: 1;
        max-height: 60px;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .channel-sidebar.expanded {
        max-height: 300px;
    }

    .channel-sidebar-header {
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .channel-sidebar-header::after {
        content: '▼';
        font-size: 10px;
        color: rgba(255, 255, 255, 0.4);
        transition: transform 0.3s ease;
    }

    .channel-sidebar.expanded .channel-sidebar-header::after {
        transform: rotate(180deg);
    }

    .chat-main-area {
        grid-column: 1;
        grid-row: 2;
    }

    .chat-input-container {
        grid-column: 1;
        grid-row: 3;
        padding: 10px 12px;
    }

    .chat-messages-enhanced {
        max-height: none;
        min-height: 200px;
    }

    .message-item {
        max-width: 85%;
    }

    /* ---- ADMIN FORM ---- */
    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions-row {
        flex-direction: column;
    }

    .form-actions-row .wp-button {
        width: 100%;
    }

    /* ---- STAFF CARD ---- */
    .staff-card {
        min-height: auto;
    }

    .staff-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .staff-item .wp-button {
        width: 100%;
    }

    /* ---- ADMIN TASK LIST ---- */
    .admin-task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .task-actions {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .task-actions .wp-button {
        flex: 1;
    }

    .tasks-filter-group {
        flex-direction: column;
        gap: 8px;
    }

    /* ---- MODALS ---- */
    .modal-content {
        width: 95% !important;
        max-width: 100% !important;
        padding: 24px 20px;
        border-radius: 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* ---- LEVEL EDITOR MODAL ---- */
    .modal-content .form-row {
        flex-direction: column;
    }

    .modal-content .form-row>div {
        flex: 1 !important;
    }

    /* ---- MAINTENANCE CARD ---- */
    .maintenance-actions .wp-button {
        font-size: 12px;
    }

    /* ---- LEADERBOARD ---- */
    .leaderboard-list {
        padding: 0;
    }

    /* ---- COMMENTS MODAL ---- */
    #comments-modal .modal-content {
        max-height: 85vh;
    }

    /* ---- EVIDENCE ACCORDION ---- */
    .evidence-preview {
        height: 80px;
    }

    .evidence-controls {
        flex-direction: column;
    }

    .evidence-controls .wp-button {
        width: 100%;
    }
}

/* ============ SMALL MOBILE (max-width: 480px) ============ */
@media (max-width: 480px) {

    .workpass-view {
        padding: 16px 12px;
        padding-top: 24px;
    }

    .wp-card-premium {
        padding: 24px 18px;
        border-radius: 22px;
    }

    .workpass-title {
        font-size: 26px;
    }

    .workpass-description {
        font-size: 13px;
    }

    .dashboard-content {
        padding: 16px 12px 100px 12px;
    }

    .dashboard-header h2 {
        font-size: 18px;
    }

    .nav-item {
        font-size: 9px;
        min-width: 44px;
        padding: 6px 4px;
    }

    .nav-icon {
        font-size: 18px;
    }

    /* Compact XP section */
    .xp-bar-container {
        height: 10px;
    }

    .pass-xp-section {
        margin-bottom: 20px;
    }

    /* Chat tighter */
    .chat-enhanced {
        height: calc(100vh - 180px);
    }

    #chat-input {
        padding: 10px 14px;
        font-size: 13px;
    }

    #send-message-btn {
        width: 38px;
        height: 38px;
    }

    /* Auth modal even tighter */
    .auth-modal-content {
        padding: 1.5rem 1.2rem;
    }

    .auth-logo {
        width: 50px;
    }
}

/* ============ TOUCH DEVICE OPTIMIZATION ============ */
@media (hover: none) and (pointer: coarse) {

    /* Bigger tap targets */
    .wp-button {
        min-height: 44px;
        min-width: 44px;
    }

    .wp-button.sm {
        min-height: 38px;
        padding: 8px 16px;
    }

    .nav-item {
        min-height: 44px;
    }

    .card-action-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Disable hover effects on touch */
    .wp-card-premium:hover {
        transform: none;
    }

    .staff-item:hover {
        transform: none;
    }

    .message-bubble:hover {
        transform: none;
    }

    /* Make message actions always visible on touch */
    .message-bubble .message-actions {
        opacity: 1;
    }

    /* Scrollbar hide on touch */
    .dashboard-section::-webkit-scrollbar,
    .chat-messages-enhanced::-webkit-scrollbar,
    .staff-list::-webkit-scrollbar,
    .channel-list::-webkit-scrollbar {
        width: 0;
        display: none;
    }
}