/**
 * ZenStaff - Custom Styles
 * Dark Mode Theme with Gold & Green accents
 */

/* Base */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-pending {
    background-color: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.status-in_progress {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-review {
    background-color: rgba(168, 85, 247, 0.1);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.status-done {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Priority badges */
.priority-low {
    color: #6b7280;
}

.priority-medium {
    color: #3b82f6;
}

.priority-high {
    color: #f97316;
}

.priority-urgent {
    color: #ef4444;
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* User color dot */
.user-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Task card */
.task-card {
    background: #111111;
    border: 1px solid #1f1f1f;
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.task-card:hover {
    border-color: #2a2a2a;
    transform: translateY(-1px);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: #111111;
    border: 1px solid #1f1f1f;
    border-radius: 16px;
    padding: 1.5rem;
    z-index: 50;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-content.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Form inputs */
.zen-input {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #1f1f1f;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.zen-input:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.1);
}

.zen-input::placeholder {
    color: #4b5563;
}

.zen-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.zen-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: #FFD700;
    color: black;
}

.btn-primary:hover {
    background: #e6c200;
}

.btn-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-ghost {
    background: transparent;
    color: #9ca3af;
    border: 1px solid #1f1f1f;
}

.btn-ghost:hover {
    background: #1f1f1f;
    color: white;
}

/* Sidebar */
.sidebar {
    background: #0a0a0a;
    border-right: 1px solid #1f1f1f;
    width: 260px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50; /* Higher than mobile header */
    transition: transform 0.3s ease;
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.5);
    }
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #9ca3af;
    border-radius: 8px;
    margin: 0.25rem 0.75rem;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background: #1f1f1f;
    color: white;
}

.sidebar-link.active {
    background: rgba(255, 215, 0, 0.1);
    color: #FFD700;
}

/* Notification badge */
.notif-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
    margin-left: auto;
}

.notif-badge:empty {
    display: none;
}

/* Stats cards */
.stat-card {
    background: #111111;
    border: 1px solid #1f1f1f;
    border-radius: 12px;
    padding: 1.25rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* Table */
.zen-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.zen-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #1f1f1f;
}

.zen-table td {
    padding: 1rem;
    border-bottom: 1px solid #1f1f1f;
    color: #d1d5db;
    font-size: 0.875rem;
}

.zen-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: #1f1f1f;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    color: white;
    font-size: 0.875rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-left: 3px solid #22c55e;
}

.toast-error {
    border-left: 3px solid #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #1f1f1f;
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive utilities */
@media (max-width: 640px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Admin badge */
.admin-badge {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: black;
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mod-badge {
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.superadmin-badge {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============ Documents Page ============ */

/* Bootstrap Dark Theme Override */
body {
    background-color: #0a0a0a !important;
    color: #e5e7eb;
}

.navbar-dark {
    background-color: #111111 !important;
    border-bottom: 1px solid #1f1f1f;
}

.navbar-brand {
    font-weight: 700;
}

.navbar-brand .brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: black;
    border-radius: 8px;
    font-weight: 800;
    margin-right: 8px;
}

.card {
    background-color: #111111 !important;
    border: 1px solid #1f1f1f !important;
    color: #e5e7eb;
}

.form-control, .form-select {
    background-color: #0a0a0a !important;
    border-color: #1f1f1f !important;
    color: #e5e7eb !important;
}

.form-control:focus, .form-select:focus {
    border-color: rgba(255, 215, 0, 0.5) !important;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.1) !important;
}

.modal-content {
    background-color: #111111 !important;
    border: 1px solid #1f1f1f !important;
    color: #e5e7eb;
}

.modal-header {
    border-bottom-color: #1f1f1f !important;
}

.modal-footer {
    border-top-color: #1f1f1f !important;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* User Badge in Navbar */
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: #0a0a0a;
    border: 1px solid;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #e5e7eb;
}

/* Language Switcher */
.lang-switch a {
    color: #6b7280;
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.lang-switch a.active {
    background: #FFD700;
    color: black;
}

.lang-switch a:hover:not(.active) {
    color: white;
}

/* Document Card */
.document-card {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.document-card:hover {
    border-color: #2a2a2a !important;
    transform: translateY(-2px);
}

.doc-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.doc-icon.file {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.doc-icon.image {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.doc-icon.link {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.doc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.75rem;
}

.doc-author {
    font-size: 0.75rem;
}

.doc-date {
    font-size: 0.7rem;
}

.doc-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    font-size: 0.75rem;
}

.doc-badge.public {
    color: #22c55e;
}

/* User Selection Grid */
.user-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.75rem;
    background: #0a0a0a;
    border-radius: 8px;
    border: 1px solid #1f1f1f;
}

.user-check {
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.user-check:hover {
    background: #1f1f1f;
}

/* Doc Details Modal */
.doc-details {
    color: #d1d5db;
}

.shared-info .badge {
    font-size: 0.7rem;
}

/* ============ View Toggle & Member Filter ============ */
.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    background: transparent;
    border: 1px solid #1f1f1f;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn:hover {
    color: white;
    border-color: #2a2a2a;
}

.view-toggle-btn.active {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    color: #FFD700;
}

.member-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 50%;
    border: 2px solid transparent;
    background: #111;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.5;
}

.member-filter-btn:hover {
    opacity: 0.8;
}

.member-filter-btn.active {
    opacity: 1;
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.member-filter-btn[data-member="all"] {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #6b7280;
}

.member-filter-btn[data-member="all"].active {
    background: rgba(255, 215, 0, 0.1);
    color: #FFD700;
}

/* ============ Kanban Board ============ */
.kanban-column {
    background: #0a0a0a;
    border: 1px solid #1f1f1f;
    border-radius: 12px;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    font-size: 0.875rem;
}

.kanban-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kanban-cards {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    max-height: 500px;
}

.kanban-cards.drag-over {
    background: rgba(255, 215, 0, 0.05);
    border-radius: 0 0 12px 12px;
}

.kanban-card {
    background: #111111;
    border: 1px solid #1f1f1f;
    border-radius: 8px;
    padding: 0.875rem;
    cursor: grab;
    transition: all 0.2s;
}

.kanban-card:hover {
    border-color: #2a2a2a;
    transform: translateY(-1px);
}

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(2deg);
}

.kanban-card .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============ MOBILE HEADER ============ */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #0a0a0a;
    border-bottom: 1px solid #1f1f1f;
    z-index: 45; /* Below sidebar (50) but above content */
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
}

.mobile-header .logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.mobile-header .logo span {
    color: #FFD700;
}

.mobile-header .menu-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    border: 1px solid #1f1f1f;
    border-radius: 8px;
    color: #9ca3af;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-header .menu-btn:hover {
    background: #1a1a1a;
    color: white;
}

.mobile-header .menu-btn:active {
    background: #222;
    transform: scale(0.95);
}

@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
    }
    
    main {
        padding-top: 72px !important;
        margin-top: 0 !important;
    }
    
    /* Hide old mobile toggle button */
    #menuToggle {
        display: none !important;
    }
    
    /* Ensure main content header has extra margin */
    main > div:first-child,
    main > .flex:first-child {
        padding-top: 0.5rem;
    }
}

/* ============ CALENDAR RESPONSIVE ============ */
@media (max-width: 768px) {
    .calendar-grid {
        font-size: 0.7rem;
    }
    
    .calendar-cell {
        min-height: 70px;
        padding: 4px;
    }
    
    .calendar-header-cell {
        padding: 8px 4px;
        font-size: 0.65rem;
    }
    
    .calendar-day-number {
        font-size: 0.75rem;
    }
    
    .calendar-task {
        font-size: 0.6rem;
        padding: 2px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .more-tasks {
        font-size: 0.55rem;
    }
    
    /* Week view mobile */
    .week-view-row {
        grid-template-columns: 50px repeat(7, 1fr);
    }
    
    .week-time-cell {
        font-size: 0.6rem;
        padding: 4px;
    }
    
    .week-day-cell {
        padding: 2px;
    }
    
    /* Day view mobile */
    .day-view-task {
        padding: 0.875rem;
    }
    
    /* View buttons compact */
    .view-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .nav-btn {
        width: 32px;
        height: 32px;
    }
    
    #currentPeriod {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .calendar-cell {
        min-height: 55px;
        padding: 2px;
    }
    
    .calendar-task {
        font-size: 0.55rem;
        padding: 1px 3px;
        border-left-width: 2px;
    }
    
    .calendar-day-number {
        font-size: 0.7rem;
    }
    
    /* Only show 2 tasks max on mobile */
    .calendar-cell .calendar-task:nth-child(n+3) {
        display: none;
    }
    
    .calendar-cell .more-tasks {
        display: block !important;
    }
    
    /* Stacked controls on mobile */
    .calendar-controls {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ============ ENHANCED MOBILE RESPONSIVE ============ */

/* Touch-friendly base */
@media (pointer: coarse) {
    /* Larger touch targets */
    .btn, .sidebar-link, .view-toggle-btn, .member-filter-btn {
        min-height: 44px;
    }
    
    .zen-input, .zen-select {
        min-height: 48px;
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* Mobile Sidebar Overlay - handled above in .sidebar rules */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .kanban-column {
        min-height: 250px;
    }
    .kanban-cards {
        max-height: 300px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    /* Stats cards - 2 per row on mobile */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Task cards - more compact */
    .task-card {
        padding: 1rem;
    }
    
    /* Kanban horizontal scroll on mobile */
    #kanbanView > div {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 0.75rem;
        padding-bottom: 1rem;
    }
    
    .kanban-column {
        min-width: 280px;
        flex-shrink: 0;
        scroll-snap-align: start;
    }
    
    /* Better modal on mobile */
    .modal-content {
        width: 95%;
        max-height: 85vh;
        padding: 1.25rem;
        margin: 0 auto;
    }
    
    /* Full-width buttons in modals on mobile */
    .modal-content .btn {
        flex: 1;
    }
    
    /* Table responsive */
    .zen-table {
        display: block;
    }
    
    .zen-table thead {
        display: none;
    }
    
    .zen-table tbody {
        display: block;
    }
    
    .zen-table tr {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid #1f1f1f;
    }
    
    .zen-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
    }
    
    .zen-table td::before {
        content: attr(data-label);
        font-weight: 500;
        color: #6b7280;
        font-size: 0.75rem;
        text-transform: uppercase;
    }
    
    /* View toggle compact */
    .view-toggle-btn span {
        display: none;
    }
    
    /* Member filter scroll */
    .member-filter-btn:not([data-member="all"]) {
        min-width: 36px;
        height: 36px;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    /* Header adjustments */
    main h2 {
        font-size: 1.25rem;
    }
    
    /* Smaller padding */
    main {
        padding: 0.75rem !important;
    }
    
    /* Status badges smaller */
    .status-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.65rem;
    }
    
    /* Action buttons in cards */
    .task-card .btn {
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    /* Toast at bottom center */
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
    
    .toast {
        width: 100%;
    }
    
    /* Compact user cards in users.php */
    .user-select-grid {
        grid-template-columns: 1fr;
    }
    
    /* Kanban cards more compact */
    .kanban-card {
        padding: 0.75rem;
    }
    
    .kanban-card h4 {
        font-size: 0.8rem;
    }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .toast-container {
        bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    main {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    }
}

/* Smooth scrolling on mobile */
@media (prefers-reduced-motion: no-preference) {
    .kanban-cards,
    #kanbanView > div,
    .modal-content {
        scroll-behavior: smooth;
    }
}

/* Dark mode scrollbar on mobile (Chrome Android) */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
}

/* Pull-to-refresh indicator space */
body {
    overscroll-behavior-y: contain;
}

/* Prevent text selection on buttons (mobile) */
.btn, .sidebar-link, .view-toggle-btn, .member-filter-btn, .kanban-card {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Better focus states for accessibility */
.btn:focus-visible,
.zen-input:focus-visible,
.sidebar-link:focus-visible {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

/* Loading state for mobile */
.spinner {
    margin: 2rem auto;
}

/* Touch manipulation for buttons */
.touch-manipulation {
    touch-action: manipulation;
}

/* Bottom nav safe area padding */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Quick action bar on mobile */
@media (max-width: 768px) {
    /* Fixed bottom action button on mobile */
    .btn-primary.fixed-bottom-mobile {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        z-index: 20;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    }
    
    /* Cards grid adjust */
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Filters stacked on mobile */
    .filters-mobile-stack > div {
        width: 100%;
    }
    
    /* Language switcher in sidebar bigger */
    .sidebar .flex.gap-1 a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* Improved mobile modals */
@media (max-width: 640px) {
    .modal-content {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: translateY(100%);
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        width: 100%;
        max-width: 100%;
    }
    
    .modal-content.active {
        transform: translateY(0);
    }
    
    /* Drag handle indicator */
    .modal-content::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: #3a3a3a;
        border-radius: 2px;
        margin: 0 auto 1rem;
    }
}

/* Hide scrollbar on horizontal scroll (mobile kanban) */
@media (max-width: 768px) {
    #kanbanView > div::-webkit-scrollbar {
        display: none;
    }
    
    #kanbanView > div {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }
}

/* Active states for touch */
.btn:active {
    transform: scale(0.98);
}

.task-card:active,
.kanban-card:active {
    transform: scale(0.99);
}

/* Better select on mobile */
@media (max-width: 768px) {
    .zen-select {
        background-position: right 1rem center;
        padding-right: 3rem;
    }
}

/* Language switcher mobile friendly */
.lang-switch a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
