/* Reusable Apple-inspired theme layer. Load after the existing page styles. */
:root {
  color-scheme: light;
  --ios-bg: #EFE8DD;
  --ios-surface: #FFFCF7;
  --ios-elevated: #F6F0E7;
  --ios-hover: #E9E0D5;
  --ios-text: #303841;
  --ios-secondary: #4C5861;
  --ios-blue: #C63F17;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-orange: #FF5722;
  --ios-yellow: #ffcc00;
  --ios-border: #D8CEC1;
  --ios-glass: rgb(255 252 247 / 92%);
  --ios-shadow: 0 8px 24px rgb(0 0 0 / 8%);
  --ios-radius: 18px;
  --ios-radius-small: 12px;
  --ios-motion: 200ms cubic-bezier(.25, .8, .25, 1);
  /* Compatibility tokens used by the existing Customer/Admin/Shop pages. */
  --bg: var(--ios-bg);
  --surface: var(--ios-surface);
  --surface-hover: var(--ios-hover);
  --surface2: var(--ios-hover);
  --surface3: var(--ios-elevated);
  --border: var(--ios-border);
  --border-strong: color-mix(in srgb, var(--ios-secondary) 35%, var(--ios-surface));
  --text: var(--ios-text);
  --text-muted: var(--ios-secondary);
  --text-faint: var(--ios-secondary);
  --brand: var(--ios-blue);
  --brand-hover: color-mix(in srgb, var(--ios-blue) 82%, black);
  --brand-soft: color-mix(in srgb, var(--ios-blue) 10%, transparent);
  --primary: var(--ios-blue);
  --primary-hover: color-mix(in srgb, var(--ios-blue) 82%, black);
  --primary-soft: color-mix(in srgb, var(--ios-blue) 10%, transparent);
  --ok: var(--ios-green);
  --ok-soft: color-mix(in srgb, var(--ios-green) 12%, transparent);
  --bad: var(--ios-red);
  --bad-soft: color-mix(in srgb, var(--ios-red) 12%, transparent);
  --warn: var(--ios-orange);
  --warn-soft: color-mix(in srgb, var(--ios-orange) 12%, transparent);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --shadow-sm: 0 2px 8px rgb(0 0 0 / 5%);
  --shadow-md: var(--ios-shadow);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 10%);
}

html.dark {
  color-scheme: dark;
  --ios-bg: #20272D;
  --ios-surface: #303841;
  --ios-elevated: #39434B;
  --ios-hover: #46515A;
  --ios-text: #EFE8DD;
  --ios-secondary: #4C5861;
  --ios-blue: #FF7043;
  --ios-green: #30d158;
  --ios-red: #ff453a;
  --ios-orange: #FF7043;
  --ios-yellow: #ffd60a;
  --ios-border: #56616A;
  --ios-glass: rgb(48 56 65 / 92%);
  --ios-shadow: 0 8px 24px rgb(0 0 0 / 28%);
  --border-strong: color-mix(in srgb, var(--ios-secondary) 32%, var(--ios-surface));
  --brand-hover: color-mix(in srgb, var(--ios-blue) 82%, white);
  --primary-hover: color-mix(in srgb, var(--ios-blue) 82%, white);
  --shadow-sm: 0 2px 8px rgb(0 0 0 / 22%);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / 36%);
}

html,
body {
  background: var(--ios-bg);
  color: var(--ios-text);
  font-family: -apple-system, BlinkMacSystemFont, Inter, 'SF Pro Text', 'Segoe UI', sans-serif;
  letter-spacing: -0.02em;
}

body { background-image: none !important; }

/* Replace legacy fixed Tailwind brand values with the iOS system accent. */
.text-brand,
.text-copier,
.text-copier2 { color: var(--ios-blue) !important; }
.bg-brand,
.bg-copier,
.bg-copier2 { background-color: var(--ios-blue) !important; }
.border-brand,
.border-copier,
.border-copier2 { border-color: var(--ios-blue) !important; }
.from-brand { --tw-gradient-from: var(--ios-blue) var(--tw-gradient-from-position) !important; }
.ring-brand { --tw-ring-color: var(--ios-blue) !important; }

/* Apple uses clear, calm hierarchy instead of extra-heavy display weights. */
.font-black,
.font-extrabold { font-weight: 600 !important; }

.rounded-3xl { border-radius: 20px !important; }
.border-2.border-brand { border-width: 1px !important; border-color: var(--ios-border) !important; }

html.dark .bg-blue-50,
html.dark .bg-blue-100,
html.dark .bg-indigo-50,
html.dark .bg-emerald-50 { background-color: var(--ios-elevated) !important; }
html.dark .text-blue-600,
html.dark .text-blue-700,
html.dark .text-indigo-600 { color: var(--ios-blue) !important; }

h1, h2, h3, h4 {
  letter-spacing: -0.04em;
  font-weight: 600;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ios-blue) 72%, transparent);
  outline-offset: 3px;
}

.apple-card {
  background: var(--ios-surface);
  border: 1px solid var(--ios-border);
  border-radius: var(--ios-radius);
  box-shadow: var(--ios-shadow);
}

.apple-button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .75rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--ios-radius);
  background: var(--ios-blue);
  color: #fff;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: transform var(--ios-motion), background-color var(--ios-motion), box-shadow var(--ios-motion);
  -webkit-tap-highlight-color: transparent;
}

.apple-button:hover { filter: brightness(1.04); }
.apple-button:active { transform: scale(.95); }
.apple-button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.apple-input {
  width: 100%;
  min-height: 52px;
  padding: .875rem 1rem;
  border: 1px solid var(--ios-border);
  border-radius: var(--ios-radius-small);
  background: var(--ios-hover);
  color: var(--ios-text);
  font: inherit;
  letter-spacing: -0.02em;
  transition: box-shadow var(--ios-motion), border-color var(--ios-motion), background-color var(--ios-motion);
}

.apple-input::placeholder { color: var(--ios-secondary); }
.apple-input:focus { outline: none; border-color: var(--ios-blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ios-blue) 22%, transparent); }

.apple-glass-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ios-glass);
  border-bottom: 1px solid var(--ios-border);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}

/* Bring the existing pages' components into the same system without changing their markup or behavior. */
.card {
  background: var(--ios-surface) !important;
  color: var(--ios-text);
  border-color: var(--ios-border) !important;
  border-radius: var(--ios-radius) !important;
  box-shadow: var(--ios-shadow) !important;
}

.glass-strong,
header.sticky,
.glass {
  background: var(--ios-glass) !important;
  border-color: var(--ios-border) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}

footer#bar {
  background: var(--ios-glass) !important;
  border: 1px solid var(--ios-border);
  border-radius: var(--ios-radius) var(--ios-radius) 0 0;
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
}

.btn-primary,
button.btn-primary {
  min-height: 52px;
  border-radius: var(--ios-radius) !important;
  background: var(--ios-blue) !important;
  border-color: var(--ios-blue) !important;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ios-blue) 22%, transparent) !important;
  transition: transform var(--ios-motion), background-color var(--ios-motion), box-shadow var(--ios-motion) !important;
}

.btn-primary:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn-primary:active { transform: scale(.97); }

/* Dashboard actions stay compact; kiosk actions retain the larger touch target. */
body.ios-dashboard .btn,
body.ios-dashboard .btn-primary,
body.ios-dashboard .btn-danger,
body.ios-dashboard .btn-ok,
body.ios-dashboard .btn-warn,
body.ios-dashboard .agent-toggle-btn {
  min-height: 36px !important;
  padding: 7px 12px !important;
  border-radius: 12px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
  box-shadow: 0 2px 7px rgb(0 0 0 / 8%) !important;
}

body.ios-dashboard .btn:active,
body.ios-dashboard .btn-primary:active { transform: scale(.97); }

.tab { min-height: 48px; border-radius: 12px 12px 0 0; }
.tab.on { color: var(--ios-blue) !important; border-bottom-color: var(--ios-blue) !important; }

input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='hidden']),
select,
textarea {
  min-height: 48px;
  padding: 12px 16px !important;
  border-color: var(--ios-border) !important;
  border-radius: var(--ios-radius-small) !important;
  background-color: var(--ios-hover);
  color: var(--ios-text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ios-blue) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ios-blue) 22%, transparent) !important;
}

html.dark .ambient { background-image: none !important; }
html.dark .bg-white { background-color: var(--ios-surface) !important; }
html.dark .bg-slate-50,
html.dark .bg-slate-100,
html.dark .bg-gray-50,
html.dark .bg-gray-100 { background-color: var(--ios-elevated) !important; }
html.dark .text-slate-900,
html.dark .text-slate-800,
html.dark .text-gray-900,
html.dark .text-gray-800 { color: var(--ios-text) !important; }
html.dark .text-slate-500,
html.dark .text-slate-600,
html.dark .text-gray-500,
html.dark .text-gray-600 { color: var(--ios-secondary) !important; }

.apple-pressable { transition: transform var(--ios-motion), background-color var(--ios-motion), box-shadow var(--ios-motion); }
.apple-pressable:hover { transform: scale(1.01); }
.apple-pressable:active { transform: scale(.95); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Cetak Mandiri palette compatibility layer */
.apple-button{background:var(--ios-blue);color:#fff}
html.dark .apple-button{background:#FF7043;color:#20272D}
.apple-card{background:var(--ios-surface);border-color:var(--ios-border)}
@media(prefers-color-scheme:dark){
 html:not(.light):not(.dark){color-scheme:dark;--ios-bg:#20272D;--ios-surface:#303841;--ios-elevated:#39434B;--ios-hover:#46515A;--ios-text:#EFE8DD;--ios-secondary:#D7D0C6;--ios-blue:#FF7043;--ios-orange:#FF7043;--ios-border:#56616A;--ios-glass:rgb(48 56 65 / 92%)}
 html:not(.light):not(.dark) body{background:var(--ios-bg);color:var(--ios-text)}
 html:not(.light):not(.dark) .apple-button{background:#FF7043;color:#20272D}
}
