@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

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

:root {
    --primary: #0f766e;
    --primary-hover: #115e59;
    --primary-soft: #e4f3ef;
    --secondary: #475467;
    --success: #15803d;
    --warning: #b45309;
    --danger: #b42318;
    --info: #155eef;
    --bg: #ddd9d4;
    --bg-accent: #f7f5f1;
    --card-bg: rgba(255, 255, 255, 0.74);
    --surface-2: rgba(255, 255, 255, 0.5);
    --surface-3: rgba(255, 255, 255, 0.32);
    --surface-dark: #0f172a;
    --border: rgba(194, 201, 210, 0.6);
    --border-dark: rgba(156, 166, 179, 0.82);
    --text: #111827;
    --text-2: #475467;
    --text-muted: #667085;
    --text-subtle: #98a2b3;
    --glass-strong: rgba(255, 255, 255, 0.68);
    --glass-panel: rgba(255, 255, 255, 0.54);
    --glass-soft: rgba(255, 255, 255, 0.38);
    --glass-faint: rgba(255, 255, 255, 0.24);
    --glass-contrast: rgba(250, 250, 249, 0.86);
    --glass-blur: 24px;
    --sidebar-width: 278px;
    --topbar-h: 72px;
    --content-max: 1520px;
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-pill: 999px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.02), 0 16px 34px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 22px 48px rgba(15, 23, 42, 0.07);
    --shadow: 0 28px 60px rgba(15, 23, 42, 0.09);
    --shadow-lg: 0 34px 76px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 42px 96px rgba(15, 23, 42, 0.16);
    --transition-fast: 160ms ease;
    --transition: 240ms cubic-bezier(.2, .8, .2, 1);
}

body.dark {
    --bg: #09111c;
    --bg-accent: #101925;
    --card-bg: rgba(13, 21, 34, 0.72);
    --surface-2: rgba(255, 255, 255, 0.08);
    --surface-3: rgba(255, 255, 255, 0.04);
    --surface-dark: #020817;
    --border: rgba(173, 191, 215, 0.16);
    --border-dark: rgba(173, 191, 215, 0.28);
    --text: #f8fafc;
    --text-2: #d6dee8;
    --text-muted: #a7b4c3;
    --text-subtle: #8392a5;
    --glass-strong: rgba(10, 18, 30, 0.78);
    --glass-panel: rgba(10, 18, 30, 0.64);
    --glass-soft: rgba(255, 255, 255, 0.06);
    --glass-faint: rgba(255, 255, 255, 0.03);
    --glass-contrast: rgba(18, 28, 41, 0.86);
    --shadow-xs: 0 1px 2px rgba(2, 8, 23, 0.5);
    --shadow-sm: 0 12px 26px rgba(2, 8, 23, 0.34);
    --shadow: 0 22px 50px rgba(2, 8, 23, 0.44);
    --shadow-lg: 0 32px 74px rgba(2, 8, 23, 0.56);
    --shadow-xl: 0 40px 90px rgba(2, 8, 23, 0.62);
}

@media (max-width: 1360px) {
    :root {
        --sidebar-width: 262px;
        --content-max: 1420px;
    }
}

@media (min-width: 1600px) {
    :root {
        --content-max: 1640px;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.9) 0 4%, transparent 16%),
        radial-gradient(circle at 50% -2%, rgba(255, 255, 255, 0.92) 0 5%, transparent 16%),
        radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.72) 0 4.5%, transparent 15%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 34%),
        linear-gradient(180deg, #d6d2cc 0%, var(--bg-accent) 42%, var(--bg) 100%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    font-size: clamp(13px, .92vw, 14px);
    line-height: 1.58;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent unwanted zooming on mobile */
    -webkit-text-size-adjust: 100%;
}

body.dark {
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.05) 0 5%, transparent 16%),
        radial-gradient(circle at 52% -2%, rgba(255, 255, 255, 0.08) 0 6%, transparent 18%),
        radial-gradient(circle at 84% 16%, rgba(15, 118, 110, 0.14) 0 5%, transparent 18%),
        linear-gradient(140deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0) 28%),
        linear-gradient(180deg, #050b13 0%, #0a1220 42%, var(--bg) 100%);
}

body::before,
body::after {
    content: '';
    position: fixed;
    pointer-events: none;
    z-index: -1;
    opacity: 0.92;
}

body::before {
    top: -18vh;
    right: -8vw;
    width: min(48vw, 760px);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.54) 0%, rgba(255, 255, 255, 0.16) 36%, rgba(255, 255, 255, 0.04) 52%, transparent 72%);
    filter: blur(10px);
}

body::after {
    left: -12vw;
    bottom: -28vh;
    width: min(54vw, 860px);
    aspect-ratio: 1;
    border-radius: 50%;
    background:
        radial-gradient(circle at 38% 34%, rgba(255, 255, 255, 0.5) 0%, transparent 32%),
        radial-gradient(circle at center, rgba(15, 118, 110, 0.16) 0%, rgba(15, 118, 110, 0.04) 44%, transparent 70%);
    filter: blur(14px);
}

body.dark::before {
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 36%, rgba(15, 118, 110, 0.06) 52%, transparent 72%);
}

body.dark::after {
    background:
        radial-gradient(circle at 38% 34%, rgba(255, 255, 255, 0.06) 0%, transparent 32%),
        radial-gradient(circle at center, rgba(15, 118, 110, 0.16) 0%, rgba(15, 118, 110, 0.04) 44%, transparent 70%);
}

body.app-shell {
    overflow-x: hidden;
}

body.auth-page {
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

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

button {
    color: inherit;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(102, 112, 133, 0.28);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 84, 103, 0.46);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::selection {
    background: rgba(15, 118, 110, 0.18);
    color: var(--text);
}

.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--danger) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }
.small { font-size: .8125rem; }
.w-100 { width: 100%; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.rp::before { content: 'Rp '; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

/* Prevent zoom on input focus iOS */
input,
select,
textarea,
button {
    font-size: 16px;
}

@media (min-width: 768px) {
    input,
    select,
    textarea,
    button {
        font-size: 15px;
    }
}

/* Touch-friendly sizes on mobile */
@media (max-width: 768px) {
    body.auth-page {
        padding: 16px;
    }
    
    body {
        font-size: clamp(12.75px, 1.05vw, 13.75px);
        background-attachment: scroll;
    }
    
    /* Minimum 44px touch target */
    button,
    a[role="button"],
    .btn,
    input[type="button"],
    input[type="submit"],
    input[type="reset"] {
        min-height: 44px;
        padding: 10px 16px;
    }
    
    /* Reduce padding on mobile */
    .card {
        padding: clamp(12px, 3vw, 20px);
    }
    
    /* Optimize form spacing */
    form {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    /* Responsive text sizes */
    h1 { font-size: clamp(1.22rem, 2.2vw, 1.33rem); }
    h2 { font-size: clamp(1.08rem, 1.9vw, 1.18rem); }
    h3 { font-size: clamp(1rem, 1.7vw, 1.08rem); }
    h4 { font-size: clamp(0.92rem, 1.5vw, 1rem); }
    h5 { font-size: clamp(0.86rem, 1.3vw, 0.92rem); }
    h6 { font-size: clamp(0.8rem, 1.15vw, 0.86rem); }
}

/* Landscape mode - reduce height issues */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        font-size: 13px;
    }
    
    .card {
        padding: 12px 16px;
        margin-bottom: 12px;
    }
    
    h1 { font-size: 1.12rem; }
    h2 { font-size: 1.02rem; }
    h3 { font-size: 0.95rem; }
}

/* High DPI screens - optimize rendering */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: subpixel-antialiased;
    }
}
