/* =========================================================
           JTG SYSTEM — GLOBAL UI FOUNDATION
           Visual/layout only. No API/backend logic.
        ========================================================= */

html,
body {
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100dvh;
    background: #f8fafc;
    color: #0f172a;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

[x-cloak] {
    display: none !important;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    touch-action: manipulation;
}

/* Better scrolling on Apple devices */
.jtg-scroll {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* Desktop scrollbar */
.jtg-scroll::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

.jtg-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.jtg-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.jtg-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Prevent flex children from creating horizontal overflow */
.jtg-shell,
.jtg-main,
.jtg-page {
    min-width: 0;
    max-width: 100%;
}

/* Main application background */
.jtg-main {
    background:
        radial-gradient(circle at top right,
            rgba(59, 130, 246, 0.035),
            transparent 32rem),
        #f8fafc;
}

/* Mobile safe area */
.jtg-mobile-header {
    padding-top: env(safe-area-inset-top);
}

.jtg-mobile-header-inner {
    height: 60px;
}

/* Sidebar active indicator */
.jtg-nav-active {
    position: relative;
}

.jtg-nav-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 22px;
    transform: translateY(-50%);
    border-radius: 0 999px 999px 0;
    background: #60a5fa;
}

/* Toast safe-area support */
.jtg-toast {
    padding-top: max(0.65rem, env(safe-area-inset-top));
}

/* Focus visibility */
:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduce motion for users who request it */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* =========================================================
           MOBILE
        ========================================================= */

@media (max-width: 767px) {
    body {
        font-size: 13px;
    }

    .jtg-page {
        width: 100%;
        min-width: 0;
    }
}

/* =========================================================
           DESKTOP
        ========================================================= */

@media (min-width: 768px) {
    .jtg-desktop-sidebar {
        width: 248px;
    }
}

@media (min-width: 1280px) {
    .jtg-desktop-sidebar {
        width: 264px;
    }
}

/* =========================================================
           PRINT
        ========================================================= */

@media print {

    html,
    body {
        width: 100% !important;
        max-width: none !important;
        overflow: visible !important;
        background: white !important;
    }

    .print-hidden,
    #site-navigation,
    #mobile-navigation-header,
    #global-toast {
        display: none !important;
    }

    #main-content {
        width: 100% !important;
        max-width: none !important;
        overflow: visible !important;
    }
}