/* Shared theme layer for SIAR pages */
:root {
    --siar-page-max: 1540px;
    --siar-control-min-height: 2.85rem;
}

html {
    font-size: 16px;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16.5px;
    }
}

@media (min-width: 1280px) {
    html {
        font-size: 17px;
    }
}

@media (min-width: 1536px) {
    html {
        font-size: 17.5px;
    }
}

@media (max-width: 380px) {
    html {
        font-size: 15.5px;
    }
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: #f8fafc;
    line-height: 1.55;
}

@media print {
    nav,
    form,
    .no-print {
        display: none !important;
    }

    body {
        background: white;
    }

    .shadow-sm,
    .shadow-md {
        box-shadow: none !important;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    th,
    td {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}

@keyframes float-icon {
    0% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

@keyframes slow-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.hover-float:hover i {
    animation: float-icon 1.5s ease-in-out infinite;
}

.spin-slow:hover i {
    animation: slow-spin 8s linear infinite;
}

.glass-header {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.nav-link {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(243, 244, 246, 0.8);
    border-radius: 0.75rem;
    z-index: -1;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover::before {
    transform: scale(1);
    opacity: 1;
}

@media (min-width: 1024px) {
    .container {
        max-width: min(var(--siar-page-max), calc(100vw - 3rem)) !important;
    }
}

input,
select,
textarea {
    font-size: max(1rem, 16px);
}

button,
.btn,
a[class*="px-"],
input,
select,
textarea {
    min-height: var(--siar-control-min-height);
}

table {
    font-size: 0.98rem;
}

th,
td {
    vertical-align: middle;
}

@media (max-width: 640px) {
    :root {
        --siar-control-min-height: 2.75rem;
    }

    body {
        line-height: 1.5;
    }

    .container {
        width: 100%;
        max-width: 100% !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    table {
        font-size: 0.92rem;
    }
}

.siar-theme-switcher {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 9999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    box-shadow: 0 6px 20px rgba(2, 6, 23, 0.12);
}

.siar-theme-switcher label {
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.siar-theme-switcher select {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 8px;
    min-width: 96px;
}

.siar-theme-switcher select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.siar-theme-switcher--inline {
    position: static;
    right: auto;
    bottom: auto;
    z-index: auto;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

.siar-theme-icon-button {
    display: inline-flex;
    width: 2.25rem;
    height: 2.25rem;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 999px;
    background: #ffffff;
    color: #4338ca;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.siar-theme-icon-button:hover {
    transform: translateY(-1px);
    background: #eef2ff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.2);
}

.siar-theme-icon-button:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.siar-theme-icon-button [data-theme-icon] {
    display: none;
    width: 1.1rem;
    height: 1.1rem;
}

.siar-theme-icon-button svg {
    display: block;
    width: 100%;
    height: 100%;
}

.siar-theme-icon-button[data-mode="light"] [data-theme-icon="light"],
.siar-theme-icon-button[data-mode="dark"] [data-theme-icon="dark"],
.siar-theme-icon-button[data-mode="auto"] [data-theme-icon="auto"] {
    display: block;
}

html.theme-dark body {
    background-color: #020617 !important;
    color: #e2e8f0 !important;
}

html.theme-dark .bg-gray-50,
html.theme-dark .bg-slate-50,
html.theme-dark .bg-gray-100,
html.theme-dark .bg-slate-100,
html.theme-dark .bg-white,
html.theme-dark .bg-white\/50,
html.theme-dark .bg-white\/80,
html.theme-dark .bg-white\/90 {
    background-color: #0f172a !important;
}

html.theme-dark .text-gray-900,
html.theme-dark .text-gray-800,
html.theme-dark .text-slate-900,
html.theme-dark .text-slate-800,
html.theme-dark .text-slate-700 {
    color: #e2e8f0 !important;
}

html.theme-dark .text-gray-700,
html.theme-dark .text-gray-600,
html.theme-dark .text-gray-500,
html.theme-dark .text-slate-600,
html.theme-dark .text-slate-500 {
    color: #94a3b8 !important;
}

html.theme-dark .border-gray-100,
html.theme-dark .border-gray-200,
html.theme-dark .border-gray-300,
html.theme-dark .border-slate-100,
html.theme-dark .border-slate-200,
html.theme-dark .border-slate-300 {
    border-color: #334155 !important;
}

html.theme-dark nav.bg-white,
html.theme-dark .glass-header {
    background: rgba(2, 6, 23, 0.84) !important;
    border-bottom-color: rgba(71, 85, 105, 0.45) !important;
}

html.theme-dark .siar-theme-switcher {
    border-color: #475569;
    background: rgba(15, 23, 42, 0.92);
}

html.theme-dark .siar-theme-switcher label {
    color: #cbd5e1;
}

html.theme-dark .siar-theme-switcher select {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #475569;
}

html.theme-dark .siar-theme-switcher--inline {
    background: transparent;
    border-color: transparent;
}

html.theme-dark .siar-theme-icon-button {
    border-color: rgba(148, 163, 184, 0.5);
    background: #0f172a;
    color: #c7d2fe;
}

/* Komponen pencarian bersama untuk seluruh formulir SIAR. */
.siar-modern-search {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 56px;
    gap: 12px;
    padding: 7px 14px 7px 8px;
    border: 1px solid #dbe3f0;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.siar-modern-search:focus-within {
    border-color: #818cf8;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12), 0 8px 22px rgba(79, 70, 229, 0.08);
}

.siar-modern-search__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    color: #ffffff;
    font-size: 20px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 55%, #4338ca 100%);
    box-shadow: 0 7px 15px rgba(79, 70, 229, 0.22);
}

.siar-modern-search__input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    color: #172033;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 15px;
    font-weight: 500;
}

.siar-modern-search__input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.siar-modern-search--compact {
    min-height: 46px;
    gap: 10px;
    padding: 5px 11px 5px 6px;
    border-radius: 11px;
}

.siar-modern-search--compact .siar-modern-search__icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 17px;
}

.siar-modern-search--compact .siar-modern-search__input {
    height: 34px;
    font-size: 14px;
}

.siar-modern-search .select2-container {
    flex: 1 1 auto;
    min-width: 0;
    width: 100% !important;
}

.siar-modern-search .select2-container--default .select2-selection--single {
    height: 40px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.siar-modern-search .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 0;
    padding-right: 32px;
    color: #172033;
    line-height: 40px;
    font-size: 15px;
    font-weight: 500;
}

.siar-modern-search .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

html.theme-dark .siar-modern-search {
    border-color: #334155;
    background: linear-gradient(180deg, #111c30 0%, #0f172a 100%);
}

html.theme-dark .siar-modern-search:focus-within {
    border-color: #818cf8;
    background: #0f172a;
}

html.theme-dark .siar-modern-search__input {
    color: #e2e8f0;
}

html.theme-dark .siar-modern-search .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #e2e8f0;
}

@media (max-width: 640px) {
    .siar-theme-switcher {
        right: 10px;
        bottom: 10px;
        padding: 6px 8px;
    }

    .siar-theme-switcher--inline {
        right: auto;
        bottom: auto;
        padding: 0;
    }

    .siar-theme-switcher label {
        display: none;
    }
}
