/* base.css — Multi-Theme POS Design System */
:root,
html[data-theme="emerald"] {
    /* Neutral Surfaces */
    --color-bg-primary:     #F5F7F9;
    --color-bg-secondary:   #ECEFF3;
    --color-bg-card:        #FFFFFF;
    --color-border:         #E5E9F0;
    --color-border-strong:  #CBD5E1;

    /* Emerald Green Accent (Default) */
    --color-accent:         #159968;
    --color-accent-hover:   #107C53;
    --color-accent-soft:    #E7F7F0;
    --color-accent-pill:    #CBECE0;
    --color-accent-rgb:     21, 153, 104;

    /* Dark Charcoal & Semantic Colors */
    --color-espresso:       #22292F;
    --color-espresso-light: #36414C;
    --color-amber:          var(--color-accent);
    --color-amber-dark:     var(--color-accent-hover);
    --color-amber-soft:     var(--color-accent-soft);

    --color-success:        #159968;
    --color-success-soft:   #E7F7F0;
    --color-danger:         #E11D48;
    --color-danger-soft:    #FFE4E6;
    --color-warning:        #D97706;
    --color-warning-soft:   #FEF3C7;
    --color-info:           #2563EB;
    --color-info-soft:      #DBEAFE;

    /* Typography */
    --color-text-primary:   #1E293B;
    --color-text-secondary: #64748B;
    --color-text-muted:     #94A3B8;

    --font-primary: 'Plus Jakarta Sans', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;

    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.045);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.16);
}

/* Theme 2: Warm Latte (Coklat Muda) */
html[data-theme="latte"] {
    --color-bg-primary:     #F7F5F2;
    --color-bg-secondary:   #F0ECE6;
    --color-border:         #ECE6DE;
    --color-border-strong:  #DDD3C6;
    --color-accent:         #B88B5E;
    --color-accent-hover:   #9E7247;
    --color-accent-soft:    #F6EDE3;
    --color-accent-pill:    #EDE0D1;
    --color-accent-rgb:     184, 139, 94;
}

/* Theme 3: Ocean Blue */
html[data-theme="ocean"] {
    --color-accent:         #2563EB;
    --color-accent-hover:   #1D4ED8;
    --color-accent-soft:    #EFF6FF;
    --color-accent-pill:    #DBEAFE;
    --color-accent-rgb:     37, 99, 235;
}

/* Custom Font Presets */
html[data-font="jakarta"] { --font-primary: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif; }
html[data-font="poppins"] { --font-primary: 'Poppins', 'Segoe UI', system-ui, sans-serif; }
html[data-font="inter"]   { --font-primary: 'Inter', 'Segoe UI', system-ui, sans-serif; }
html[data-font="outfit"]  { --font-primary: 'Outfit', 'Segoe UI', system-ui, sans-serif; }
html[data-font="nunito"]  { --font-primary: 'Nunito', 'Segoe UI', system-ui, sans-serif; }
html[data-font="dm-sans"] { --font-primary: 'DM Sans', 'Segoe UI', system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-primary);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }

.ico {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* Hide Admin-only elements from Kasir */
html.role-kasir [data-role="pemilik"] {
    display: none !important;
}

/* =========================================================================
   AUTH GATE
   ========================================================================= */
html.auth-locked .app-shell {
    display: none !important;
}
.auth-gate {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background:
        radial-gradient(circle at 15% 20%, rgba(var(--color-accent-rgb), 0.16), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(var(--color-accent-rgb), 0.14), transparent 45%),
        linear-gradient(150deg, #F8FAFC 0%, #E2E8F0 100%);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
html.auth-locked .auth-gate {
    display: flex;
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: #FFFFFF;
    border-radius: 24px;
    padding: 38px 34px 30px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    border: 1px solid var(--color-border);
    text-align: center;
}
.auth-logo-wrap {
    width: 84px;
    height: 84px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(var(--color-accent-rgb), 0.22);
    border: 3px solid var(--color-accent-soft);
}
.auth-logo { width: 100%; height: 100%; object-fit: cover; }
.auth-title { font-size: 1.4rem; color: var(--color-text-primary); }
.auth-sub { font-size: 0.87rem; color: var(--color-text-secondary); margin: 6px 0 24px; }
.auth-form { text-align: left; }
.auth-input-wrap { position: relative; }
.auth-input-wrap input {
    padding-left: 40px;
    padding-right: 42px;
    height: 46px;
    border-radius: 12px;
}
.auth-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}
.auth-eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    display: inline-flex;
}
.auth-eye-btn:hover { color: var(--color-text-primary); background: var(--color-bg-primary); }
.auth-error {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 0.83rem;
    font-weight: 600;
    margin-top: 10px;
}
.auth-error.show { display: flex; }
.auth-submit { margin-top: 16px; height: 46px; font-size: 0.95rem; border-radius: 12px; }
.auth-foot {
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    font-size: 0.78rem;
    color: var(--color-text-muted);
    font-weight: 600;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
.shake { animation: shake 0.32s ease; }

/* =========================================================================
   LEFT SLIM ICON-ONLY SIDEBAR + WORKSPACE SHELL
   ========================================================================= */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg-primary);
}

.slim-sidebar {
    width: 84px;
    flex-shrink: 0;
    background: #FFFFFF;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 500;
}

.ss-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.ss-logo-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--color-accent-soft);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    background: var(--color-bg-primary);
}
.ss-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ss-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.ss-link {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    background: transparent;
    transition: all 0.16s ease;
    position: relative;
}
.ss-link .ico {
    width: 21px;
    height: 21px;
}
.ss-link:hover {
    color: var(--color-accent);
    background: var(--color-accent-soft);
}
.ss-link.active {
    background: var(--color-accent);
    color: #FFFFFF;
    box-shadow: 0 8px 18px rgba(var(--color-accent-rgb), 0.32);
}

/* Tooltip on hover */
.ss-link[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: #1E293B;
    color: #FFFFFF;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.ss-link[data-tip]:hover::after {
    opacity: 1;
}

.ss-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.ss-user-pill {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--color-text-secondary);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    padding: 3px 7px;
    border-radius: 999px;
    max-width: 74px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}
.ss-logout-btn {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    border: 1px solid var(--color-border);
    background: #FFFFFF;
    color: #94A3B8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.16s ease;
}
.ss-logout-btn:hover {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border-color: rgba(225, 29, 72, 0.25);
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    flex: 1;
    width: 100%;
    max-width: 1520px;
    margin: 0 auto;
    padding: 20px 26px 28px;
}

.footer {
    border-top: 1px solid var(--color-border);
    background: #FFFFFF;
    color: var(--color-text-muted);
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 12px 20px;
    letter-spacing: 0.01em;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}
.page-title {
    font-size: 1.35rem;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-title-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--color-accent-soft);
    color: var(--color-accent-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-sub {
    color: var(--color-text-secondary);
    font-size: 0.86rem;
    margin-top: 3px;
}

.date-pill-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    font-weight: 600;
}
.date-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    border: 1px solid var(--color-border);
    padding: 8px 14px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    color: var(--color-text-primary);
    font-size: 0.84rem;
    font-weight: 600;
}
.date-pill .ico { color: var(--color-accent); }

@media (max-width: 900px) {
    .app-shell {
        flex-direction: column;
    }
    .slim-sidebar {
        width: 100%;
        height: 64px;
        flex-direction: row;
        padding: 0 14px;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }
    .ss-logo-wrap { width: 38px; height: 38px; }
    .ss-nav {
        flex-direction: row;
        justify-content: center;
        gap: 6px;
        overflow-x: auto;
    }
    .ss-link { width: 40px; height: 40px; border-radius: 11px; }
    .ss-link[data-tip]::after { display: none; }
    .ss-bottom { flex-direction: row; }
    .container { padding: 16px 14px 24px; }
}
