/*
 * NjordViam Touch Interface CSS
 * Adaptive styling based on display-adapter.js detection
 *
 * Classes applied by display-adapter.js:
 * - body.display-kiosk  (Pi Display 2 kiosk)
 * - body.display-desktop (standard browser)
 * - body.display-mobile (phone)
 * - body.display-tablet (tablet)
 * - body.touch-primary (touch is main input)
 * - body.touch-secondary (touch available, mouse primary)
 * - body.no-touch (mouse only)
 */

/* ===== SIDE MENU BASE STYLES ===== */
.side-menu-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    background: #fff;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.12);
    z-index: 1002;
    padding: 0;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    overflow: hidden;
}

/* Kiosk mode - wider menu */
body.display-kiosk .side-menu-nav {
    width: 320px;
}

/* Menu close button */
.menu-close-btn {
    position: absolute;
    top: 0.8em;
    right: 0.8em;
    background: none;
    border: none;
    font-size: 1.5em;
    color: #888;
    cursor: pointer;
    z-index: 10;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.display-kiosk .menu-close-btn {
    font-size: 2em;
    min-width: 56px;
    min-height: 56px;
    top: 0.5em;
    right: 0.5em;
}

/* Menu scroll container */
.menu-scroll-container {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 3em 0.8em 1em 0.8em;
    -webkit-overflow-scrolling: touch;
}

body.display-kiosk .menu-scroll-container {
    padding: 4em 1em 1em 1em;
}

/* Menu items container */
.menu-items-container {
    gap: 2px;
}

body.display-kiosk .menu-items-container {
    gap: 8px;
}

/* ===== KIOSK MODE - LARGER TOUCH TARGETS ===== */
/* Step 2: Touch-friendly sizing for 7" touchscreen */

/* All buttons - larger touch targets */
body.display-kiosk button,
body.display-kiosk .btn,
body.display-kiosk [role="button"],
body.display-kiosk a.btn {
    min-height: 56px !important;
    min-width: 56px !important;
    font-size: 18px !important;
    padding: 14px 24px !important;
}

/* Hamburger menu button - prominent touch target */
body.display-kiosk #menu-btn {
    min-height: 60px !important;
    min-width: 60px !important;
    font-size: 32px !important;
    padding: 12px !important;
}

/* Phone book menu items - larger touch targets */
body.display-kiosk .menu-item,
body.display-kiosk #unified-menu-container a,
body.display-kiosk #unified-menu-container button,
body.display-kiosk #side-menu a,
body.display-kiosk .flex.flex-col > a,
body.display-kiosk .flex.flex-col > div > a {
    min-height: 60px !important;
    font-size: 20px !important;
    padding: 16px 20px !important;
    display: flex !important;
    align-items: center !important;
}

/* Menu close button */
body.display-kiosk #side-menu button[onclick*="closeMenu"] {
    min-height: 50px !important;
    min-width: 50px !important;
    font-size: 28px !important;
}

/* Wider side menu for kiosk - prevent text wrapping */
body.display-kiosk #side-menu {
    width: 320px !important;
}

/* Form inputs - larger for touch */
body.display-kiosk input,
body.display-kiosk select,
body.display-kiosk textarea {
    min-height: 52px !important;
    font-size: 18px !important;
    padding: 14px !important;
}

/* ===== KIOSK MODE - CURSOR HIDING ===== */
/* Hide cursor on kiosk (no mouse connected) */
body.display-kiosk,
body.display-kiosk * {
    cursor: none !important;
}

/* Disable text selection on kiosk */
body.display-kiosk {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}

/* Hide scrollbars on kiosk */
html:has(body.display-kiosk),
body.display-kiosk {
    overflow: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

html:has(body.display-kiosk)::-webkit-scrollbar,
body.display-kiosk::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* Also hide on any scrollable containers */
body.display-kiosk *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}

body.display-kiosk * {
    scrollbar-width: none !important;
}

/* ===== TOUCH FEEDBACK CIRCLE ===== */
/* Visual feedback when touching the screen */
.touch-feedback {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 123, 255, 0.4) 0%, rgba(0, 123, 255, 0.1) 70%, transparent 100%);
    border: 2px solid rgba(0, 123, 255, 0.6);
    box-shadow:
        0 0 20px rgba(0, 123, 255, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%) scale(0);
    animation: touchPulse 0.6s ease-out forwards;
}

@keyframes touchPulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* ===== BUTTON TOUCH RESPONSE ===== */
/* Press feedback for touch-primary devices */
body.touch-primary button:active,
body.touch-primary .btn:active,
body.touch-primary [role="button"]:active {
    transform: scale(0.95);
    background-color: rgba(0, 123, 255, 0.2);
    transition: all 0.1s ease;
}

/* ===== STEP 4: KIOSK POLISH ===== */

/* Header - more compact for portrait screen */
body.display-kiosk header {
    padding: 6px 12px !important;
    margin-bottom: 16px !important;  /* More gap after header */
}

/* Main content - tighter spacing */
body.display-kiosk main {
    padding: 8px !important;
    margin-top: 0 !important;
}

/* Cards and panels - tighter but still touch-friendly */
body.display-kiosk .bg-white,
body.display-kiosk .rounded-lg {
    padding: 10px !important;
    margin-bottom: 8px !important;
}

/* Links - larger touch area */
body.display-kiosk a {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
}

/* Status badges - more readable */
body.display-kiosk .badge,
body.display-kiosk [class*="badge"] {
    font-size: 14px !important;
    padding: 8px 12px !important;
}

/* NjordLINK status badge in header */
body.display-kiosk #njordlink-status-badge {
    font-size: 12px !important;
    padding: 6px 10px !important;
}

/* Dashboard grid items - tighter spacing */
body.display-kiosk .grid {
    gap: 6px !important;
}

/* Icons in buttons - larger */
body.display-kiosk button i,
body.display-kiosk .btn i,
body.display-kiosk a i {
    font-size: 1.2em !important;
    margin-right: 8px !important;
}

/* ===== LEGACY SUPPORT ===== */
/* Keep old pi-touch-mode class working */
body.pi-touch-mode button,
body.pi-touch-mode .btn {
    min-height: 56px !important;
}
