/**
 * VivaSon Checker v1.7.0 - style.css
 * CSS custom en complement de Tailwind CDN
 * F8: Dark mode via CSS custom properties
 */

/* ============================================
   F8: CSS VARIABLES (Light / Dark mode)
   ============================================ */
:root {
    --bg-primary: #FAFAFA;
    --bg-card: #FFFFFF;
    --bg-card-alt: #F8FAFC;
    --bg-input: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --border-color: #E2E8F0;
    --border-color-light: #F1F5F9;
    --shadow-color: rgba(0, 0, 0, 0.06);
    --overlay-color: rgba(0, 0, 0, 0.2);
}

html.dark {
    --bg-primary: #0F172A;
    --bg-card: #1E293B;
    --bg-card-alt: #1A2332;
    --bg-input: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --border-color: #334155;
    --border-color-light: #1E293B;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --overlay-color: rgba(0, 0, 0, 0.5);
}

/* --- Dark mode overrides --- */
html.dark body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

html.dark header {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

html.dark .bg-white,
html.dark .bg-background-light {
    background-color: var(--bg-card) !important;
}

html.dark .bg-slate-50,
html.dark .bg-slate-100 {
    background-color: var(--bg-card-alt) !important;
}

html.dark .text-slate-900,
html.dark .text-slate-800 {
    color: var(--text-primary) !important;
}

html.dark .text-slate-700,
html.dark .text-slate-600 {
    color: var(--text-secondary) !important;
}

html.dark .text-slate-500,
html.dark .text-slate-400 {
    color: var(--text-muted) !important;
}

html.dark .border-slate-200,
html.dark .border-slate-100 {
    border-color: var(--border-color) !important;
}

html.dark input,
html.dark textarea,
html.dark select {
    background-color: var(--bg-input) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

html.dark table tbody tr:hover {
    background-color: var(--bg-card-alt) !important;
}

html.dark .side-panel {
    background: var(--bg-card) !important;
}

html.dark .side-panel-header {
    background: var(--bg-card-alt) !important;
    border-color: var(--border-color) !important;
}

html.dark .side-panel-overlay.open {
    background: var(--overlay-color) !important;
}

html.dark .crm-list-row:hover {
    background-color: var(--bg-card-alt) !important;
}

html.dark .crm-list-row.selected {
    background-color: #1E3A5F !important;
}

html.dark .crm-list-row.active-panel {
    background-color: #172554 !important;
    border-left-color: #3B82F6 !important;
}

html.dark .crm-bulk-bar {
    background: #172554 !important;
    border-color: #1E3A5F !important;
}

html.dark .pagination-controls {
    background: var(--bg-card-alt) !important;
    border-color: var(--border-color) !important;
}

html.dark .pagination-controls .page-btn {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

html.dark .import-action-bar {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

html.dark .kanban-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

html.dark #mobile-menu {
    background: var(--bg-card) !important;
}

html.dark .side-panel-nav button {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #475569;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #64748B;
}

/* Dropdown menus */
html.dark #user-dropdown-menu,
html.dark #global-search-results {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

html.dark #user-dropdown-menu a:hover {
    background: var(--bg-card-alt) !important;
}

/* Modals */
html.dark .modal-content,
html.dark [id$="-modal"] > div > div {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Hover states */
html.dark .hover\:bg-slate-50:hover,
html.dark .hover\:bg-slate-100:hover {
    background-color: var(--bg-card-alt) !important;
}

/* Dark mode toggle button active state */
html.dark #dark-mode-toggle {
    background-color: var(--bg-card-alt);
}

html.dark #dark-mode-toggle .material-symbols-outlined {
    color: #FBBF24;
}

/* Stats cards / dashboard */
html.dark .stat-card,
html.dark [class*="rounded-xl"][class*="bg-white"],
html.dark [class*="rounded-lg"][class*="bg-white"] {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

/* Keyboard help tooltip (F2) */
html.dark #keyboard-help {
    background: #0F172A !important;
    border-color: #334155 !important;
}

/* Rappel modal (F7) */
html.dark #rappel-modal > div {
    background: var(--overlay-color);
}

/* Import toast (F4) - keep as-is, it's always green */

/* ============================================
   BASE
   ============================================ */
body {
    font-family: "Inter", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   LOGIN PAGE (index.php)
   ============================================ */
.bg-viva-gradient {
    background: linear-gradient(135deg, #E6007E 0%, #C4006B 50%, #9B0054 100%);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* ============================================
   KANBAN
   ============================================ */
.kanban-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kanban-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.kanban-column {
    min-height: 100px;
}

/* SortableJS ghost */
.sortable-ghost {
    opacity: 0.3;
}

.sortable-chosen {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.sortable-drag {
    transform: rotate(2deg);
}

/* Kanban horizontal scroll */
#kanban-view {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-content {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   PROGRESS BAR GLOW
   ============================================ */
#progress-bar {
    transition: width 0.3s ease;
}

/* ============================================
   MODAL
   ============================================ */
#client-modal > div {
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ============================================
   TABLE HOVER
   ============================================ */
table tbody tr {
    transition: background-color 0.15s ease;
}

/* ============================================
   RESPONSIVE NAV
   ============================================ */
@media (max-width: 768px) {
    .kanban-wrapper {
        min-width: 260px !important;
        width: 260px !important;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    header, nav, #mobile-menu, #mobile-menu-btn, button, .no-print {
        display: none !important;
    }
    body {
        background: white;
    }
    main {
        padding: 0;
    }
}

/* ============================================
   IMPORT STICKY ACTION BAR (v1.5.3)
   ============================================ */
.import-action-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid #E2E8F0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ============================================
   PAGINATION (v1.5.3)
   ============================================ */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.875rem;
}

.pagination-controls .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-controls .page-btn:hover:not(:disabled):not(.active) {
    border-color: #0066CC;
    color: #0066CC;
    background: #F0F7FF;
}

.pagination-controls .page-btn.active {
    background: #0066CC;
    border-color: #0066CC;
    color: #fff;
}

.pagination-controls .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================
   CRM SIDE PANEL (v1.5.3)
   ============================================ */
.side-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.side-panel-overlay.open {
    opacity: 1;
    visibility: visible;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: #fff;
    z-index: 210;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-panel.open {
    transform: translateX(0);
}

.side-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E2E8F0;
    background: #F8FAFC;
    flex-shrink: 0;
}

.side-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.side-panel-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.side-panel-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.side-panel-nav button:hover:not(:disabled) {
    border-color: #0066CC;
    color: #0066CC;
    background: #F0F7FF;
}

.side-panel-nav button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ============================================
   CRM BULK ACTION BAR (v1.5.3)
   ============================================ */
.crm-bulk-bar {
    position: sticky;
    top: 0;
    z-index: 90;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    margin-bottom: 12px;
    animation: fadeIn 0.2s ease-out;
}

.crm-bulk-bar.visible {
    display: flex;
}

/* ============================================
   CRM STATUS BADGES (v1.5.3)
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.status-badge.a_appeler { background: #DBEAFE; color: #1E40AF; }
.status-badge.a_rappeler { background: #FFEDD5; color: #9A3412; }
.status-badge.message_laisse { background: #FEF3C7; color: #92400E; }
.status-badge.rdv_pris { background: #DCFCE7; color: #166534; }
.status-badge.pas_interesse { background: #FEE2E2; color: #991B1B; }

/* ============================================
   CRM LIST VIEW COMPACT (v1.5.3)
   ============================================ */
.crm-list-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.crm-list-row:hover {
    background-color: #F8FAFC;
}

.crm-list-row.selected {
    background-color: #EFF6FF;
}

.crm-list-row.active-panel {
    background-color: #F0F7FF;
    border-left: 3px solid #0066CC;
}

/* ============================================
   RESPONSIVE SIDE PANEL (v1.5.3)
   ============================================ */
@media (max-width: 768px) {
    .side-panel {
        width: 100vw;
    }
}

/* ============================================
   ROLE BADGES
   ============================================ */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.5;
}

.role-badge-admin {
    background-color: #FEE2E2;
    color: #DC2626;
}

.role-badge-manager {
    background-color: #DBEAFE;
    color: #2563EB;
}

.role-badge-assistante {
    background-color: #F3E8FF;
    color: #7C3AED;
}

/* ============================================
   RESPONSIVE MOBILE (v1.6.0)
   ============================================ */

/* --- Mobile Menu Overlay --- */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Body scroll lock when menu is open */
body.mobile-menu-locked {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    touch-action: none;
}

#mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    z-index: 45;
    background: #ffffff;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

#mobile-menu.menu-open {
    transform: translateX(0);
    pointer-events: auto;
}

/* --- iOS Zoom Prevention on Inputs --- */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* --- Touch Targets --- */
@media (max-width: 768px) {
    .touch-target,
    .crm-bulk-bar button,
    .pagination-controls .page-btn,
    .side-panel-nav button {
        min-width: 44px;
        min-height: 44px;
    }

    /* Action buttons in tables */
    table button,
    table a.inline-flex {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }
}

/* --- Filter Collapse on Mobile --- */
@media (max-width: 768px) {
    .filter-collapse-content {
        display: none;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        padding-top: 12px;
    }

    .filter-collapse-content.open {
        display: flex;
    }

    .filter-collapse-content select,
    .filter-collapse-content input {
        width: 100% !important;
        min-width: 0 !important;
    }
}

@media (min-width: 769px) {
    .filter-collapse-btn {
        display: none !important;
    }

    .filter-collapse-content {
        display: contents !important;
    }
}

/* --- Modal Responsive --- */
@media (max-width: 640px) {
    .modal-responsive {
        max-width: 95vw !important;
        margin: 8px !important;
        width: calc(100vw - 16px) !important;
    }

    .modal-responsive .p-6,
    .modal-responsive .px-6 {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* --- CRM Bulk Bar Mobile --- */
@media (max-width: 640px) {
    .crm-bulk-bar.visible {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 12px;
    }

    .crm-bulk-bar .bulk-actions {
        width: 100%;
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
    }
}

/* --- Pagination Mobile --- */
@media (max-width: 640px) {
    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 8px 10px;
    }

    .pagination-controls .page-btn {
        min-width: 36px;
        height: 36px;
    }
}

/* --- Side Panel Mobile Fullscreen --- */
@media (max-width: 768px) {
    .side-panel {
        width: 100vw;
        border-radius: 0;
    }

    .side-panel-header {
        padding: 12px 16px;
    }

    .side-panel-body {
        padding: 16px;
    }
}

/* --- Kanban Mobile --- */
@media (max-width: 768px) {
    .kanban-wrapper {
        min-width: 240px !important;
        width: 240px !important;
    }

    .kanban-card {
        padding: 10px 12px;
    }

    .kanban-card:hover {
        transform: none;
    }

    #kanban-view {
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 8px;
    }

    .kanban-wrapper {
        scroll-snap-align: start;
    }
}

/* --- Import drop zone mobile --- */
@media (max-width: 640px) {
    .drop-zone-responsive {
        padding: 24px 16px !important;
    }
}

/* --- Header Mobile Adjustments --- */
@media (max-width: 768px) {
    header {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* --- Page padding mobile --- */
@media (max-width: 640px) {
    .page-padding {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* --- Mobile card view for tables --- */
@media (max-width: 640px) {
    .table-scroll-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    .table-scroll-wrapper table {
        min-width: 600px;
    }
}

/* --- Grid responsive helpers --- */
@media (max-width: 640px) {
    .grid-responsive-1 {
        grid-template-columns: 1fr !important;
    }

    .grid-responsive-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ============================================
   M2: BOTTOM NAVIGATION MOBILE (<640px)
   ============================================ */
#bottom-nav {
    display: none;
}

@media (max-width: 639px) {
    #bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        z-index: 40;
        justify-content: space-around;
        align-items: center;
        background: #FFFFFF;
        border-top: 1px solid #E2E8F0;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
        padding: 0 4px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Body padding to prevent content hidden behind bottom nav */
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    /* Hide bottom nav when side panel is open */
    body.side-panel-open #bottom-nav {
        display: none;
    }

    /* Also hide when mobile menu is open */
    body.mobile-menu-locked #bottom-nav {
        display: none;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    padding: 6px 2px 4px;
    color: #64748B;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

.bottom-nav-item .material-symbols-outlined {
    font-size: 22px;
    transition: color 0.15s ease;
}

.bottom-nav-item.active {
    color: #E6007E;
}

.bottom-nav-item.active .material-symbols-outlined {
    color: #E6007E;
}

.bottom-nav-item:active {
    opacity: 0.7;
}

/* Badge rappels on CRM tab */
.bottom-nav-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    transform: translateX(calc(50% + 10px));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    line-height: 1;
}

/* Dark mode bottom nav */
html.dark #bottom-nav {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}

html.dark .bottom-nav-item {
    color: var(--text-muted);
}

html.dark .bottom-nav-item.active {
    color: #E6007E;
}

html.dark .bottom-nav-item.active .material-symbols-outlined {
    color: #E6007E;
}

/* ============================================
   M2: BOTTOM SHEET "Plus"
   ============================================ */
#bottom-sheet-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 41;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#bottom-sheet-overlay.open {
    display: block;
    opacity: 1;
}

#bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 42;
    background: #FFFFFF;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    max-height: 80vh;
    overflow-y: auto;
}

#bottom-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-handle-area {
    display: flex;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: grab;
}

.bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: #CBD5E1;
    border-radius: 2px;
}

.bottom-sheet-content {
    padding: 4px 16px 16px;
}

.bottom-sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    border-radius: 10px;
    color: #334155;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.bottom-sheet-item:active {
    background: #F1F5F9;
}

.bottom-sheet-item .material-symbols-outlined {
    font-size: 22px;
    color: #64748B;
}

.bottom-sheet-info {
    cursor: default;
    font-size: 13px;
    color: #64748B;
}

.bottom-sheet-danger {
    color: #EF4444;
}

.bottom-sheet-danger .material-symbols-outlined {
    color: #EF4444 !important;
}

.bottom-sheet-divider {
    height: 1px;
    background: #E2E8F0;
    margin: 4px 12px;
}

/* Dark mode bottom sheet */
html.dark #bottom-sheet-overlay.open {
    background: var(--overlay-color);
}

html.dark #bottom-sheet {
    background: var(--bg-card);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

html.dark .bottom-sheet-handle {
    background: #475569;
}

html.dark .bottom-sheet-item {
    color: var(--text-primary);
}

html.dark .bottom-sheet-item:active {
    background: var(--bg-card-alt);
}

html.dark .bottom-sheet-item .material-symbols-outlined {
    color: var(--text-muted);
}

html.dark .bottom-sheet-info {
    color: var(--text-muted);
}

html.dark .bottom-sheet-danger {
    color: #F87171;
}

html.dark .bottom-sheet-danger .material-symbols-outlined {
    color: #F87171 !important;
}

html.dark .bottom-sheet-divider {
    background: var(--border-color);
}

/* Hide bottom sheet on desktop */
@media (min-width: 640px) {
    #bottom-sheet,
    #bottom-sheet-overlay {
        display: none !important;
    }
}

/* ============================================
   M1: SWIPE GESTURES ON KANBAN CARDS
   ============================================ */
.kanban-card.swiping {
    transition: none !important;
    will-change: transform;
    z-index: 5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.kanban-card.snap-back {
    transition: transform 0.2s ease, background-color 0.2s ease !important;
}

.swipe-confirm-flash {
    animation: swipeFlash 0.4s ease-out !important;
}

@keyframes swipeFlash {
    0% { opacity: 0.8; transform: scale(0.98); }
    50% { opacity: 0.5; transform: scale(1.01); }
    100% { opacity: 1; transform: scale(1); }
}

/* ============================================
   M4: SIDE PANEL TOUCH — Drag indicator
   ============================================ */
.sp-drag-indicator {
    display: flex;
    justify-content: center;
    padding: 8px 0 4px;
    cursor: grab;
}

.sp-drag-handle {
    width: 36px;
    height: 4px;
    background: #CBD5E1;
    border-radius: 2px;
}

html.dark .sp-drag-handle {
    background: #475569;
}

/* Hide drag indicator on desktop */
@media (min-width: 640px) {
    .sp-drag-indicator {
        display: none;
    }
}

/* M4: Sticky action buttons on mobile */
@media (max-width: 639px) {
    .sp-actions-sticky {
        position: sticky;
        bottom: 0;
        background: #FFFFFF;
        padding: 12px 16px;
        border-top: 1px solid #E2E8F0;
        z-index: 5;
        margin: 0 -16px -16px;
    }

    html.dark .sp-actions-sticky {
        background: var(--bg-card);
        border-color: var(--border-color);
    }
}

/* ============================================
   M3: PULL-TO-REFRESH
   ============================================ */
#ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 35;
    padding: 8px;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#ptr-indicator.ptr-hidden {
    opacity: 0;
    pointer-events: none;
}

#ptr-indicator.ptr-visible {
    opacity: 1;
}

.ptr-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #E2E8F0;
    border-top-color: #E6007E;
    border-radius: 50%;
    transition: transform 0.1s ease;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ptr-spinner.ptr-ready {
    border-top-color: #22C55E;
    border-right-color: #22C55E;
}

.ptr-spinner.ptr-refreshing {
    animation: ptrSpin 0.6s linear infinite;
}

@keyframes ptrSpin {
    to { transform: rotate(360deg); }
}

html.dark .ptr-spinner {
    border-color: var(--border-color);
    border-top-color: #E6007E;
    background: var(--bg-card);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

html.dark .ptr-spinner.ptr-ready {
    border-top-color: #22C55E;
    border-right-color: #22C55E;
}

/* =========================================================
   M5: Offline Banner
   ========================================================= */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 39;
    text-align: center;
    background: #FEF3C7;
    color: #92400E;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    animation: offlineBannerSlide 0.3s ease;
}

.offline-banner.hidden {
    display: none;
}

@keyframes offlineBannerSlide {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

html.dark .offline-banner {
    background: #78350F;
    color: #FDE68A;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* On mobile, position below header */
@media (max-width: 639px) {
    .offline-banner {
        top: 56px; /* below header */
    }
}

/* ============================================
   HELP PAGE (v1.7.0)
   ============================================ */
.help-tab {
    transition: all 0.2s ease;
    border: 1px solid;
    flex-shrink: 0;
}

.help-section {
    overflow: hidden;
}

.help-section-arrow {
    transition: transform 0.2s ease;
}

.help-section-body {
    animation: fadeIn 0.2s ease-out;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Dark mode help page */
html.dark .help-tab {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
}

html.dark .help-tab[class*="bg-primary"] {
    background-color: rgba(0, 102, 204, 0.15) !important;
    border-color: #0066CC !important;
    color: #60A5FA !important;
}

html.dark .help-section {
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

html.dark .help-section-toggle:hover {
    background-color: var(--bg-card-alt) !important;
}

/* ============================
   DEMO BANNER
   ============================ */
.demo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #FFFFFF;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1;
}

.demo-banner-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    max-width: 100%;
}

.demo-banner-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.demo-banner-exit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    padding: 4px 12px;
    background: rgba(255,255,255,0.2);
    color: #FFFFFF;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.demo-banner-exit:hover {
    background: rgba(255,255,255,0.35);
}

/* Push content below fixed demo banner */
body.has-demo-banner header {
    top: 37px;
}

body.has-demo-banner .mobile-bottom-nav {
    /* bottom nav stays at bottom, no change needed */
}

/* Responsive: mobile banner */
@media (max-width: 640px) {
    .demo-banner {
        font-size: 11px;
    }
    .demo-banner-inner {
        padding: 6px 10px;
        gap: 6px;
    }
    .demo-banner-text strong {
        display: inline;
    }
    .demo-banner-text {
        font-size: 11px;
    }
    .demo-banner-exit {
        font-size: 11px;
        padding: 3px 10px;
    }
    body.has-demo-banner header {
        top: 33px;
    }
}

/* Dark mode */
html.dark .demo-banner {
    background: linear-gradient(135deg, #4F46E5, #7C3AED);
}
