/* ==========================================================================
   SitePilot Pro Design System - Craftsmanship, Anti-Slop, iOS PWA
   ========================================================================== */

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* Native iOS Feel & Touch Optimization */
html {
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overscroll-behavior-y: none;
}

/* iOS Safe Areas */
.safe-pt {
    padding-top: max(0.875rem, calc(var(--safe-top) + 0.35rem));
}

.safe-pb {
    padding-bottom: max(0.875rem, calc(var(--safe-bottom) + 0.35rem));
}

.safe-mb-bottom-bar {
    padding-bottom: calc(7rem + var(--safe-bottom, 0px)) !important;
}

/* Tactile Micro-Interactions */
.tap-press {
    transition: transform 0.12s cubic-bezier(0.2, 0.8, 0.4, 1), opacity 0.12s ease;
}
.tap-press:active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* Monospace Numbers */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* Refined Segmented Tabs (Desktop Subbar) */
.nav-tab {
    color: #71717a;
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.15s ease-out;
}
.nav-tab:hover {
    color: #18181b;
    background-color: #f4f4f5;
}
.nav-tab.active {
    color: #18181b;
    background-color: #ffffff;
    border-color: #e4e4e7;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dark .nav-tab {
    color: #a1a1aa;
    background: transparent;
    border: 1px solid transparent;
}
.dark .nav-tab:hover {
    color: #f4f4f5;
    background-color: #27272a;
}
.dark .nav-tab.active {
    color: #fafafa;
    background-color: #18181b;
    border-color: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* Site Filter Chips */
.site-filter-btn {
    background-color: #f4f4f5;
    color: #71717a;
    border: 1px solid #e4e4e7;
    transition: all 0.15s ease-out;
}
.site-filter-btn:hover {
    background-color: #e4e4e7;
    color: #18181b;
}
.site-filter-btn.active {
    background-color: #18181b;
    color: #ffffff;
    border-color: #18181b;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.dark .site-filter-btn {
    background-color: #18181b;
    color: #a1a1aa;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.dark .site-filter-btn:hover {
    background-color: #27272a;
    color: #fafafa;
    border-color: rgba(255, 255, 255, 0.15);
}
.dark .site-filter-btn.active {
    background-color: #27272a;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background-color: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(228, 228, 231, 0.9);
    padding-bottom: max(0.5rem, var(--safe-bottom));
}
.dark .mobile-bottom-nav {
    background-color: rgba(9, 9, 11, 0.92);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.25rem;
    color: #71717a;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    position: relative;
    transition: color 0.12s ease;
}
.mobile-nav-btn.active {
    color: #4f46e5;
    font-weight: 700;
}
.dark .mobile-nav-btn {
    color: #a1a1aa;
}
.dark .mobile-nav-btn.active {
    color: #818cf8;
    font-weight: 700;
}

/* Mobile Action Bottom Sheet */
@media (max-width: 639px) {
    .modal-sheet-dialog {
        position: fixed;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        max-width: 100% !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-top-left-radius: 1.5rem !important;
        border-top-right-radius: 1.5rem !important;
        max-height: 88vh !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: max(2.5rem, calc(var(--safe-bottom, 0px) + 1.5rem)) !important;
        animation: slideUpSheet 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

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

    .sheet-handle {
        width: 36px;
        height: 4px;
        background-color: #d4d4d8;
        border-radius: 9999px;
        margin: 0.5rem auto 0.75rem auto;
    }
    .dark .sheet-handle {
        background-color: #3f3f46;
    }
}

/* Hairline scrollbars & scroll helpers */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
    background: #27272a;
}
::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;
}
.dark ::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* Plugin Changelog Modal Content */
.plugin-changelog-content h3,
.plugin-changelog-content h4 {
    font-size: 0.875rem;
    font-weight: 700;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(120, 120, 128, 0.15);
    color: #18181b;
}
.dark .plugin-changelog-content h3,
.dark .plugin-changelog-content h4 {
    color: #f4f4f5;
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
.plugin-changelog-content h3:first-child,
.plugin-changelog-content h4:first-child {
    margin-top: 0;
}
.plugin-changelog-content ul {
    list-style-type: disc;
    padding-left: 1.25rem;
    margin-top: 0.35rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.plugin-changelog-content li {
    line-height: 1.55;
    color: #3f3f46;
}
.dark .plugin-changelog-content li {
    color: #a1a1aa;
}
.plugin-changelog-content p {
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    line-height: 1.55;
}
.plugin-changelog-content code {
    background: rgba(120, 120, 128, 0.12);
    padding: 0.125rem 0.35rem;
    border-radius: 0.375rem;
    font-family: ui-monospace, monospace;
    font-size: 0.75rem;
}
.plugin-changelog-content a {
    color: #6366f1;
    text-decoration: underline;
}

