@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --color-grape-900: #0f172a;
    --color-slate-800: #1e293b;
    --color-slate-600: #475569;
    --color-slate-500: #64748b;
    --color-slate-400: #94a3b8;
    --color-slate-200: #e2e8f0;
    --color-slate-100: #f1f5f9;
    --color-slate-50: #f8fafc;

    --color-primary: #000000;
    --color-primary-hover: #252525;

    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-warning: #d97706;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-slate-50);
    color: var(--color-slate-800);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Navbar */
.navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-slate-200);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0.75rem 0;
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-grape-900);
}

.brand-logo-circle {
    width: 32px;
    height: 32px;
    background: var(--color-grape-900);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.brand-text-col {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--color-slate-500);
    font-weight: 500;
}

/* Hero */
.hero {
    padding: 5rem 0 4rem;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--color-grape-900);
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero h1 span {
    background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    background-clip: text;
    /* standard property */
    -webkit-text-fill-color: transparent;
    border-right: 0.1em solid var(--color-grape-900);
    /* Cursor */
    animation: blink-cursor 0.75s step-end infinite;
}

@keyframes blink-cursor {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--color-grape-900);
    }
}

.hero p {
    font-size: 1.125rem;
    color: var(--color-slate-500);
    max-width: 500px;
    margin: 0 auto 3rem;
    line-height: 1.6;
}

/* Modern Search */
.search-box {
    background: white;
    border: 1px solid var(--color-slate-200);
    padding: 0.5rem;
    border-radius: 9999px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    max-width: 560px;
    margin: 0 auto;
    transition: all 0.2s ease;
}

.search-box:focus-within {
    border-color: #2563eb;
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.search-icon {
    padding-left: 1rem;
    color: var(--color-slate-400);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-slate-800);
    padding: 0.75rem 1rem;
    background: transparent;
}

.search-button {
    background: var(--color-grape-900);
    color: white;
    font-weight: 600;
    border: none;
    padding: 0.75rem 1.75rem;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-button:hover {
    background: #000;
}

.info-notice {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-slate-500);
    background: rgba(255, 255, 255, 0.5);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    border: 1px solid var(--color-slate-200);
}

/* Results */
.main-content {
    flex: 1;
    padding-bottom: 4rem;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-slate-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    margin: 4rem auto;
    animation: spin 0.8s linear infinite;
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-slate-400);
    display: none;
}

/* Table Card */
.result-card {
    background: white;
    border: 1px solid var(--color-slate-200);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-top: 2rem;
    display: none;
    /* hidden initially */
}

.result-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-grape-900);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem 1.5rem;
    background: var(--color-slate-50);
    color: var(--color-slate-500);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-slate-200);
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-slate-100);
    vertical-align: top;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #fafafa;
}

/* Cell Content */
.user-info .name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-grape-900);
    margin-bottom: 0.35rem;
}

.badge-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    padding: 1px 8px;
    border-radius: 9999px;
    font-weight: 500;
    border: 1px solid transparent;
}

.badge-outline {
    border-color: var(--color-slate-200);
    color: var(--color-slate-600);
    background: white;
}

.badge-mono {
    background: var(--color-slate-100);
    color: var(--color-slate-600);
    font-family: 'Monaco', monospace;
    letter-spacing: -0.02em;
}

.date-text {
    font-size: 0.9rem;
    color: var(--color-slate-600);
}

.amount-box {
    text-align: right;
}

.amount-total {
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-success);
}

.amount-detail {
    font-size: 0.75rem;
    color: var(--color-slate-500);
}

.subsider-badge {
    display: inline-block;
    background: #fef2f2;
    color: var(--color-danger);
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    margin-top: 4px;
    font-weight: 600;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--color-slate-200);
    color: var(--color-slate-400);
    font-size: 0.85rem;
    background: white;
    margin-top: auto;
}

/* Mobile */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }

    /* Navbar Tweaks */
    .brand-text-col {
        display: none;
        /* Hide full text, keep logo */
    }

    .nav-inner>div:last-child>div:last-child {
        display: none;
        /* Hide Date on mobile */
    }

    .btn-guide span {
        display: none;
        /* Hide text "Panduan", keep icon */
    }

    .btn-guide {
        padding: 0.5rem;
    }

    /* Hero Tweaks */
    .hero {
        padding: 3rem 0 2rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .search-box {
        width: 100%;
        border-radius: 20px;
        padding: 0.35rem;
    }

    .search-input {
        font-size: 0.95rem;
        padding: 0.5rem;
    }

    .search-button {
        padding: 0.6rem 1.2rem;
        border-radius: 16px;
        font-size: 0.9rem;
    }

    .info-notice {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
        text-align: left;
        border-radius: 12px;
    }

    /* Table Card View */
    thead {
        display: none;
    }

    tr {
        display: block;
        background: white;
        border: 1px solid var(--color-slate-200);
        border-radius: 12px;
        margin-bottom: 1rem;
        box-shadow: var(--shadow-sm);
        padding: 0.5rem;
    }

    td {
        display: block;
        padding: 0.75rem 0.5rem;
        border-bottom: 1px solid var(--color-slate-50);
    }

    td:last-child {
        border-bottom: none;
        padding-bottom: 0.5rem;
    }

    /* Remove the main result-card container styles that conflict */
    .result-card {
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .result-header {
        background: white;
        border: 1px solid var(--color-slate-200);
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .amount-box {
        text-align: left;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--color-slate-200);
        margin-top: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }

    /* Modal Tweaks */
    .modal-box {
        margin: 1rem;
        max-height: 80vh;
    }
}

/* Fade In */
/* Fade In Animation */
.fade-up {
    animation: fadeUp 0.5s ease-out forwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: white;
    width: 100%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-overlay.open .modal-box {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-grape-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--color-slate-400);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--color-slate-100);
    color: var(--color-grape-900);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    color: var(--color-slate-600);
    line-height: 1.6;
    font-size: 0.95rem;
}

.modal-body h4 {
    color: var(--color-grape-900);
    margin: 1.5rem 0 0.5rem;
    font-size: 1rem;
}

.modal-body h4:first-child {
    margin-top: 0;
}

.modal-body ul,
.modal-body ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.modal-body li {
    margin-bottom: 0.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-slate-200);
    text-align: right;
    background: var(--color-slate-50);
    border-radius: 0 0 16px 16px;
}

.btn-modal {
    background: var(--color-grape-900);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-modal:hover {
    background: #000;
}

/* Nav Button for Modal */
.btn-guide {
    background: transparent;
    border: 1px solid var(--color-slate-200);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-slate-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-guide:hover {
    background: var(--color-slate-100);
    color: var(--color-grape-900);
    border-color: var(--color-slate-300);
}