/* Portal Aplikasi Pemerintah Desa Gelgel */
:root {
    --primary: #0f6b4f;
    --primary-dark: #0a4c39;
    --primary-soft: #eaf5f1;
    --gold: #d4a72c;
    --gold-soft: #fff7dc;

    --bg: #f2f6f5;
    --surface: rgba(255, 255, 255, 0.92);
    --surface-solid: #ffffff;
    --text: #152033;
    --muted: #667085;
    --border: #e4e9e7;
    --shadow: 0 14px 34px rgba(21, 32, 51, 0.08);

    --container: 1380px;
    --radius: 18px;
}

[data-theme="dark"] {
    --bg: #111916;
    --surface: rgba(25, 37, 32, 0.94);
    --surface-solid: #192520;
    --text: #f1f7f4;
    --muted: #aebcb6;
    --border: #31423b;
    --shadow: 0 16px 38px rgba(0, 0, 0, 0.28);
    --primary-soft: #173a2e;
    --gold-soft: #3a321c;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 16% 4%, rgba(15, 107, 79, 0.10), transparent 29%),
        radial-gradient(circle at 85% 2%, rgba(212, 167, 44, 0.11), transparent 27%),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    transition: background-color .25s ease, color .25s ease;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.portal-shell {
    width: min(calc(100% - 36px), var(--container));
    margin: 0 auto;
    padding: 54px 0 30px;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 30px;
}

.identity {
    min-width: 320px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.identity-logo {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
    display: grid;
    place-items: center;
    padding: 7px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface-solid);
    box-shadow: var(--shadow);
}

.identity-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.identity-copy h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3vw, 2.25rem);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.identity-copy p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: .98rem;
}

.toolbar {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(260px, 1.15fr) minmax(220px, .9fr) auto;
    justify-content: end;
    gap: 12px;
}

.search-box,
.category-box,
.theme-toggle {
    height: 52px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgba(21, 32, 51, 0.035);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    width: 13px;
    height: 13px;
    margin-left: 18px;
    border: 3px solid var(--muted);
    border-radius: 50%;
    opacity: .8;
}

.search-icon::after {
    content: "";
    position: absolute;
    width: 7px;
    height: 3px;
    margin: 9px 0 0 8px;
    border-radius: 99px;
    background: var(--muted);
    transform: rotate(45deg);
}

.search-box input,
.category-box select {
    width: 100%;
    height: 100%;
    border: 0;
    outline: 0;
    color: var(--text);
    background: transparent;
}

.search-box input {
    padding: 0 16px 0 14px;
}

.search-box input::placeholder {
    color: var(--muted);
}

.category-box {
    overflow: hidden;
}

.category-box select {
    padding: 0 44px 0 18px;
    cursor: pointer;
}

.theme-toggle {
    min-width: 126px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 16px;
    color: var(--text);
    cursor: pointer;
}

.toggle-track {
    width: 42px;
    height: 24px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    padding: 3px;
    border-radius: 999px;
    background: #536072;
    transition: background .2s ease;
}

.toggle-knob {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
    transition: transform .2s ease;
}

[data-theme="dark"] .toggle-track {
    background: var(--primary);
}

[data-theme="dark"] .toggle-knob {
    transform: translateX(18px);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

.app-card {
    min-height: 292px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(21, 32, 51, 0.035);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.app-card:hover {
    transform: translateY(-5px);
    border-color: rgba(15, 107, 79, .28);
    box-shadow: var(--shadow);
}

.app-heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-logo {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(15, 107, 79, .23);
    border-radius: 13px;
    color: #fff;
    background:
        radial-gradient(circle at 80% 20%, rgba(212, 167, 44, .95), transparent 34%),
        linear-gradient(145deg, var(--primary), var(--primary-dark));
    font-size: .9rem;
    font-weight: 900;
    letter-spacing: .05em;
}

.app-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}

.app-title {
    min-width: 0;
}

.app-title h2 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.status {
    display: inline-block;
    margin-top: 5px;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
}

.status-active {
    color: #087443;
}

.status-development {
    color: #2563a9;
}

.status-soon {
    color: #a46a00;
}

.status-internal {
    color: #6c4bc3;
}

.status-maintenance {
    color: #b42318;
}

.app-description {
    min-height: 54px;
    margin: 15px 0 16px;
    color: var(--muted);
    font-size: .94rem;
    line-height: 1.5;
}

.app-meta {
    margin-bottom: 18px;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    background: var(--surface-solid);
    font-size: .78rem;
}

.open-button {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: auto;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 9px 20px rgba(15, 107, 79, .20);
    font-weight: 800;
    transition: transform .2s ease, filter .2s ease;
}

.open-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
}

.external-icon {
    font-size: 1rem;
}

.open-button.disabled {
    color: #7c8983;
    background: var(--border);
    box-shadow: none;
    cursor: not-allowed;
}

.empty-state {
    min-height: 300px;
    display: grid;
    place-items: center;
    align-content: center;
    text-align: center;
    color: var(--muted);
}

.empty-state[hidden] {
    display: none;
}

.empty-icon {
    font-size: 2.4rem;
}

.empty-state h2 {
    margin: 12px 0 4px;
    color: var(--text);
}

.empty-state p {
    margin: 0;
}

.portal-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 34px;
    padding: 20px 2px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .86rem;
}

.portal-footer p {
    margin: 0;
}

@media (max-width: 1180px) {
    .portal-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar {
        width: 100%;
    }

    .app-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .portal-shell {
        width: min(calc(100% - 24px), var(--container));
        padding-top: 26px;
    }

    .identity {
        min-width: 0;
    }

    .identity-logo {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
    }

    .toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .search-box {
        grid-column: 1 / -1;
    }

    .theme-toggle {
        min-width: 0;
    }
}

@media (max-width: 560px) {
    .identity-copy h1 {
        font-size: 1.65rem;
    }

    .identity-copy p {
        font-size: .88rem;
    }

    .toolbar {
        grid-template-columns: 1fr;
    }

    .search-box {
        grid-column: auto;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .app-card {
        min-height: 275px;
    }

    .portal-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}

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