/* EasyToolio Drawing Tablet & Stylus Test Custom Styling */

/* Adaptive Canvas Surface */
.tablet-canvas-container {
    position: relative;
    width: 100%;
    height: 460px;
    background: #f8fafc;
    background-image: 
        radial-gradient(#cbd5e1 1px, transparent 1px), 
        radial-gradient(#cbd5e1 1px, #f8fafc 1px);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    border-radius: 1.5rem;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    border: 2px solid #e2e8f0;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.03), 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.dark .tablet-canvas-container {
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.7) 0%, rgba(3, 7, 18, 0.98) 100%);
    background-image: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6);
}

.tablet-canvas-container canvas#tabletCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* Fullscreen Mode Surface */
.tablet-canvas-container:fullscreen,
.tablet-canvas-container:-webkit-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #f8fafc;
}

.dark .tablet-canvas-container:fullscreen,
.dark .tablet-canvas-container:-webkit-full-screen {
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.95) 0%, rgba(3, 7, 18, 1) 100%);
}

.tablet-canvas-container:fullscreen canvas#tabletCanvas,
.tablet-canvas-container:-webkit-full-screen canvas#tabletCanvas {
    width: 100vw !important;
    height: 100vh !important;
}

/* 2-Axis Tilt Compass Graphic */
.tilt-compass-graphic {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 2px dashed rgba(6, 182, 212, 0.6);
    background: radial-gradient(circle, rgba(6, 182, 212, 0.08) 0%, #f1f5f9 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
}

.dark .tilt-compass-graphic {
    border: 1px dashed rgba(6, 182, 212, 0.4);
    background: radial-gradient(circle, rgba(6, 182, 212, 0.05) 0%, transparent 70%);
    box-shadow: none;
}

.tilt-compass-crosshair {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tilt-compass-crosshair::before,
.tilt-compass-crosshair::after {
    content: '';
    position: absolute;
    background: #cbd5e1;
}

.dark .tilt-compass-crosshair::before,
.dark .tilt-compass-crosshair::after {
    background: rgba(255, 255, 255, 0.15);
}

.tilt-compass-crosshair::before {
    top: 50%;
    left: 10px;
    right: 10px;
    height: 1.5px;
}

.tilt-compass-crosshair::after {
    left: 50%;
    top: 10px;
    bottom: 10px;
    width: 1.5px;
}

.tilt-pointer-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #06b6d4;
    border: 2px solid #ffffff;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.8);
    position: absolute;
    transform: translate(-50%, -50%);
    transition: left 0.05s ease-out, top 0.05s ease-out;
    pointer-events: none;
}

/* Pressure Meter Bar */
.pressure-meter-track {
    height: 16px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    border: 1px solid #cbd5e1;
}

.dark .pressure-meter-track {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pressure-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
    width: 0%;
    transition: width 0.04s ease-out;
    border-radius: 9999px;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

/* Pressure Over Time Graph Canvas */
.pressure-graph-canvas {
    width: 100%;
    height: 100px;
    background: #f8fafc;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
}

.dark .pressure-graph-canvas {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Real-Time On-Canvas Visual Stylus Cursor Follower */
.visual-stylus-follower {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.04s ease-out, height 0.04s ease-out, border-color 0.1s ease, background 0.1s ease;
    z-index: 25;
    display: none;
}

.visual-stylus-follower.state-hover {
    display: block;
    width: 14px;
    height: 14px;
    border: 2px solid #06b6d4;
    background: rgba(6, 182, 212, 0.15);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

.visual-stylus-follower.state-contact {
    display: block;
    border: 2px solid #ffffff;
    background: #06b6d4;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.8);
}

.visual-stylus-follower.state-eraser {
    display: block;
    border: 2px dashed #f43f5e;
    background: rgba(244, 63, 94, 0.3);
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.5);
}

/* Status Badges */
.diagnostic-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.badge-pass, .badge-detected {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.dark .badge-pass, .dark .badge-detected {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warn, .badge-pending {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fde68a;
}

.dark .badge-warn, .dark .badge-pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-unsupported, .badge-not-exposed {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
}

.dark .badge-unsupported, .dark .badge-not-exposed {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-fail {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.dark .badge-fail {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Pipeline Step Navigation Bar */
.pipeline-step {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.875rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pipeline-step:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.dark .pipeline-step {
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dark .pipeline-step:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.pipeline-step.active {
    background: #06b6d4 !important;
    color: #042f2e !important;
    border-color: #0891b2 !important;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
    font-weight: 900;
}

.pipeline-step.step-passed {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.dark .pipeline-step.step-passed {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.pipeline-step.step-warn, .pipeline-step.step-attention {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.dark .pipeline-step.step-warn, .dark .pipeline-step.step-attention {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

.pipeline-step.step-unsupported {
    background: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
}

.dark .pipeline-step.step-unsupported {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.1);
}

.pipeline-step.step-skipped {
    opacity: 0.6;
}

.pipeline-step .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.08);
    font-size: 0.7rem;
    font-weight: 800;
}

.pipeline-step.active .step-num {
    background: rgba(0, 0, 0, 0.15);
}

.dark .pipeline-step .step-num {
    background: rgba(255, 255, 255, 0.1);
}

/* Guided Drawing Target Overlays */
.corner-target-zone {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px dashed rgba(6, 182, 212, 0.5);
    background: rgba(6, 182, 212, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #0891b2;
    pointer-events: none;
    transition: all 0.2s ease;
}

.corner-target-zone.target-hit {
    background: rgba(16, 185, 129, 0.25);
    border: 2px solid #10b981;
    color: #047857;
    transform: scale(1.08);
}

.dark .corner-target-zone.target-hit {
    color: #34d399;
}

.target-tl { top: 12px; left: 12px; }
.target-tr { top: 12px; right: 12px; }
.target-bl { bottom: 12px; left: 12px; }
.target-br { bottom: 12px; right: 12px; }

/* Troubleshooting Pulse Glow */
@keyframes troubleshootPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(6, 182, 212, 0.35);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
        transform: scale(1);
    }
}

.troubleshoot-target-highlight {
    animation: troubleshootPulse 1.2s ease-in-out 3;
    border-color: #06b6d4 !important;
}

/* Compatibility & Status Badges */
.compat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
    transition: all 0.2s ease;
}

.compat-pill-active {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.dark .compat-pill-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.3);
}

.compat-pill-inactive {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.dark .compat-pill-inactive {
    background: rgba(255, 255, 255, 0.05);
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.1);
}

.compat-pill-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.dark .compat-pill-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

@media (max-width: 640px) {
    .tablet-canvas-container {
        height: 340px;
    }
    .pipeline-step {
        padding: 0.375rem 0.25rem;
        font-size: 0.7rem;
    }
}

/* Print Stylesheet for Diagnostic Report */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    header, footer, nav, #fullscreenFloatingBar, #color-palette-group, #tab-guided-mode, #tab-free-studio, .no-print {
        display: none !important;
    }
    .apple-glass {
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }
    #diagnostic-results-section {
        display: block !important;
        page-break-before: auto;
    }
}
