/* =====================================================================
   AFCI - Token desain & komponen bersama (frontend + backend)
   ===================================================================== */

:root {
    --afci-red:        #E1252C;
    --afci-red-dark:   #B4161C;
    --afci-red-soft:   rgba(225, 37, 44, .14);

    --afci-bg:         #05070C;
    --afci-bg-alt:     #0A0D14;
    --afci-panel:      #11151E;
    --afci-panel-2:    #161B26;
    --afci-line:       rgba(255, 255, 255, .08);
    --afci-line-soft:  rgba(255, 255, 255, .05);

    --afci-text:       #F2F4F8;
    --afci-muted:      #98A1B2;
    --afci-dim:        #6C7686;

    --afci-blue:       #3C7BFF;
    --afci-green:      #23B26D;
    --afci-amber:      #E8A32B;

    --afci-radius:     10px;
    --afci-radius-sm:  6px;
    --afci-shadow:     0 18px 40px rgba(0, 0, 0, .45);

    --afci-head: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
    --afci-body: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--afci-bg);
    color: var(--afci-text);
    font-family: var(--afci-body);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--afci-red); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--afci-head);
    font-weight: 800;
    letter-spacing: .01em;
    line-height: 1.05;
    margin: 0 0 .4em;
    text-transform: uppercase;
}

code {
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: .85em;
    color: #9FD0FF;
    background: rgba(60, 123, 255, .1);
    padding: .1em .4em;
    border-radius: 4px;
}

.afci-muted { color: var(--afci-muted); }
.afci-small { font-size: .82rem; }

/* ---------------------------------------------------------------------
   Eyebrow + judul bagian
   --------------------------------------------------------------------- */
.afci-eyebrow {
    font-family: var(--afci-head);
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .3em;
    text-transform: uppercase;
    color: var(--afci-red);
    margin-bottom: .35rem;
}

.afci-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.6rem;
    flex-wrap: wrap;
}

.afci-section-head h2 { font-size: 2rem; margin: 0; }

/* ---------------------------------------------------------------------
   Tombol
   --------------------------------------------------------------------- */
.afci-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .68rem 1.4rem;
    border: 1px solid transparent;
    border-radius: var(--afci-radius-sm);
    background: var(--afci-red);
    color: #fff;
    font-family: var(--afci-head);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.afci-btn:hover { background: var(--afci-red-dark); color: #fff; transform: translateY(-1px); }
.afci-btn:disabled, .afci-btn.is-disabled { opacity: .5; cursor: not-allowed; transform: none; }

.afci-btn-ghost { background: transparent; border-color: rgba(255,255,255,.28); color: var(--afci-text); }
.afci-btn-ghost:hover { background: rgba(255,255,255,.08); border-color: #fff; color: #fff; }

.afci-btn-dark { background: var(--afci-panel-2); border-color: var(--afci-line); color: var(--afci-text); }
.afci-btn-dark:hover { background: #1E2431; color: #fff; }

.afci-btn-sm { padding: .42rem .9rem; font-size: .88rem; }

/* ---------------------------------------------------------------------
   Badge status
   --------------------------------------------------------------------- */
.afci-badge {
    display: inline-block;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-family: var(--afci-head);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.afci-badge-success   { background: rgba(35,178,109,.16);  color: #4FD79A; border-color: rgba(35,178,109,.35); }
.afci-badge-secondary { background: rgba(152,161,178,.14); color: #B3BCCB; border-color: rgba(152,161,178,.3); }
.afci-badge-danger    { background: rgba(225,37,44,.16);   color: #FF6B70; border-color: rgba(225,37,44,.38); }
.afci-badge-warning   { background: rgba(232,163,43,.16);  color: #F0BE6A; border-color: rgba(232,163,43,.35); }
.afci-badge-info      { background: rgba(60,123,255,.16);  color: #7FA8FF; border-color: rgba(60,123,255,.35); }
.afci-badge-dark      { background: rgba(255,255,255,.06); color: #96A0B0; border-color: rgba(255,255,255,.12); }

/* Label kategori merah di atas kartu, seperti pada rancangan */
.afci-tag {
    position: absolute;
    top: .85rem;
    left: .85rem;
    z-index: 2;
    padding: .25rem .7rem;
    background: var(--afci-red);
    color: #fff;
    font-family: var(--afci-head);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    border-radius: 3px;
}

/* ---------------------------------------------------------------------
   Chip
   --------------------------------------------------------------------- */
.afci-chiplist { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }

.afci-chip {
    display: inline-block;
    padding: .22rem .65rem;
    border: 1px solid var(--afci-line);
    border-radius: 999px;
    background: rgba(255,255,255,.03);
    color: var(--afci-muted);
    font-size: .82rem;
}

/* ---------------------------------------------------------------------
   Navigasi pagination (Addendum pasal 27)
   --------------------------------------------------------------------- */
.afci-pager { margin-top: 1.6rem; }

.afci-pager-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.afci-pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 .8rem;
    border: 1px solid var(--afci-line);
    border-radius: var(--afci-radius-sm);
    background: var(--afci-panel);
    color: var(--afci-muted);
    font-size: .9rem;
    font-weight: 600;
    transition: all .15s ease;
}

.afci-pager-link:hover { border-color: var(--afci-red); color: #fff; background: var(--afci-panel-2); }
.afci-pager-link.is-active { background: var(--afci-red); border-color: var(--afci-red); color: #fff; }
.afci-pager-link.is-disabled { opacity: .35; pointer-events: none; }
.afci-pager-gap { display: inline-block; padding: 0 .3rem; color: var(--afci-dim); }

/* ---------------------------------------------------------------------
   Notifikasi
   --------------------------------------------------------------------- */
.afci-alert {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .85rem 1.1rem;
    border: 1px solid var(--afci-line);
    border-left-width: 3px;
    border-radius: var(--afci-radius-sm);
    background: var(--afci-panel);
    margin-bottom: 1.2rem;
}

.afci-alert-success { border-left-color: var(--afci-green); }
.afci-alert-danger  { border-left-color: var(--afci-red); }
.afci-alert-info    { border-left-color: var(--afci-blue); }
.afci-alert i { font-size: 1.1rem; line-height: 1.5; }

/* ---------------------------------------------------------------------
   Formulir
   --------------------------------------------------------------------- */
.afci-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--afci-muted);
}

.afci-input,
.afci-select,
.afci-textarea {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--afci-line);
    border-radius: var(--afci-radius-sm);
    background: var(--afci-bg-alt);
    color: var(--afci-text);
    font-family: var(--afci-body);
    font-size: .95rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.afci-input:focus,
.afci-select:focus,
.afci-textarea:focus {
    outline: none;
    border-color: var(--afci-red);
    box-shadow: 0 0 0 3px var(--afci-red-soft);
}

.afci-input::placeholder, .afci-textarea::placeholder { color: var(--afci-dim); }
.afci-select option { background: var(--afci-panel); color: var(--afci-text); }
.afci-hint { display: block; margin-top: .3rem; font-size: .78rem; color: var(--afci-dim); }
.afci-field { margin-bottom: 1.1rem; }

/* ---------------------------------------------------------------------
   Utilitas
   --------------------------------------------------------------------- */
.afci-container { width: min(1240px, calc(100% - 3rem)); margin: 0 auto; }

.afci-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--afci-dim);
    border: 1px dashed var(--afci-line);
    border-radius: var(--afci-radius);
}

.afci-empty i { display: block; font-size: 2rem; margin-bottom: .5rem; opacity: .5; }

img { max-width: 100%; }

::selection { background: var(--afci-red); color: #fff; }

@media (max-width: 720px) {
    .afci-container { width: calc(100% - 2rem); }
    .afci-section-head h2 { font-size: 1.6rem; }
}

/* Chip yang berfungsi sebagai tautan filter */
a.afci-chip { transition: all .15s ease; }
a.afci-chip:hover { color: #fff; border-color: var(--afci-red); background: rgba(225,37,44,.1); }
a.afci-chip.is-active { background: var(--afci-red); border-color: var(--afci-red); color: #fff; }

/* Tombol aksi merusak (hapus / hapus permanen) */
.afci-btn-danger { background: var(--afci-red-dark); }
.afci-btn-danger:hover { background: #8F1116; }

/* =====================================================================
   Menu mengambang (FAB) untuk ponsel & tablet
   Dipakai bersama oleh halaman depan dan backend.
   ===================================================================== */
body.afci-noscroll { overflow: hidden; }

.afci-fab-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1049;
    background: rgba(2, 4, 8, .62);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity .22s ease;
}

.afci-fab-backdrop.is-open { opacity: 1; }
.afci-fab-backdrop[hidden] { display: none; }

.afci-fab {
    display: none;
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 1050;
    flex-direction: column;
    align-items: flex-end;
}

/* Tombol bulat pemicu */
.afci-fab-toggle {
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    background: var(--afci-red);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(225, 37, 44, .42), 0 2px 8px rgba(0, 0, 0, .5);
    transition: transform .22s ease, background .2s ease;
}

.afci-fab-toggle:active { transform: scale(.94); }
.afci-fab-toggle i { transition: transform .26s ease; }
.afci-fab.is-open .afci-fab-toggle { background: var(--afci-red-dark); }
.afci-fab.is-open .afci-fab-toggle i { transform: scale(.92); }

/* Butir menu yang menyembul ke atas */
.afci-fab-items {
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: .55rem;
    margin-bottom: .85rem;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    padding: .2rem .2rem .1rem;
    scrollbar-width: none;
}

.afci-fab-items::-webkit-scrollbar { display: none; }
.afci-fab-items[hidden] { display: none; }

.afci-fab-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    opacity: 0;
    transform: translateY(14px) scale(.86);
    transition: opacity .2s ease, transform .2s ease;
    /* Muncul berurutan dari tombol ke atas */
    transition-delay: calc(var(--urutan, 0) * 26ms);
}

.afci-fab.is-open .afci-fab-item { opacity: 1; transform: none; }

.afci-fab-label {
    padding: .34rem .7rem;
    border: 1px solid var(--afci-line);
    border-radius: var(--afci-radius-sm);
    background: rgba(17, 21, 30, .96);
    color: var(--afci-text);
    font-family: var(--afci-head);
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: .07em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}

.afci-fab-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border: 1px solid var(--afci-line);
    border-radius: 50%;
    background: var(--afci-panel);
    color: var(--afci-text);
    font-size: 1.15rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}

.afci-fab-item.is-active .afci-fab-dot { background: var(--afci-red); border-color: var(--afci-red); color: #fff; }
.afci-fab-item.is-active .afci-fab-label { border-color: var(--afci-red); color: #fff; }

.afci-fab-item-cta .afci-fab-dot { background: var(--afci-red); border-color: var(--afci-red); color: #fff; }
.afci-fab-item-alt .afci-fab-dot { color: var(--afci-red); }

/* Hanya tampil pada ponsel dan tablet */
@media (max-width: 980px) {
    .afci-fab { display: flex; }
    .afci-fab-backdrop { display: block; }
}

@media (max-width: 980px) and (max-height: 700px) {
    .afci-fab-dot { width: 40px; height: 40px; font-size: 1rem; }
    .afci-fab-label { font-size: .8rem; padding: .26rem .6rem; }
    .afci-fab-items { gap: .4rem; }
}
