/* ============================================
   TAMURI - Native Mobile / Modern Android Theme
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-200: #bbf7d0;
    --green-300: #86efac;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-800: #166534;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --white: #ffffff;

    /* Shadows Modern & Elevation */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12);
    --shadow-fab: 0 8px 20px rgba(22, 163, 74, 0.35);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    line-height: 1.5;
    padding-bottom: 90px;
    /* Safe Area Padding untuk Notch / Fullscreen Screen Android */
    padding-top: env(safe-area-inset-top);
}

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

/* ============================================
   TOP APP BAR (ANDROID HEADER)
   ============================================ */
.navbar {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: var(--white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(22, 163, 74, 0.25);
}

.navbar-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.3px;
}

.navbar-title span {
    color: var(--green-600);
}

.navbar-subtitle {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 500;
}

/* ============================================
   HERO / PAGE HEADER (CARD DESIGN)
   ============================================ */
.page-header {
    background: var(--white);
    padding: 24px 20px;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.page-header-inner {
    max-width: 800px;
    margin: 0 auto;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.5px;
}

.page-header h1 span {
    color: var(--green-600);
}

.page-header p {
    color: var(--gray-500);
    font-size: 13px;
    margin-top: 2px;
}

/* Stats Widget */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.stat-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
}

.stat-info .stat-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.1;
}

.stat-info .stat-label {
    font-size: 11px;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================
   MAIN CONTENT CONTAINER
   ============================================ */
.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* -------- Search Bar (Pill App Style) -------- */
.search-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 14px 20px;
    border: 1.5px solid transparent;
    border-radius: 99px;
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--gray-800);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    background: var(--white);
    border-color: var(--green-500);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

.search-input::placeholder {
    color: var(--gray-400);
}

/* -------- Filter Chips -------- */
.filter-chips {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 6px 14px;
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.filter-chip.active {
    background: var(--green-100);
    color: var(--green-700);
    border-color: var(--green-200);
}

.filter-count-badge {
    padding: 2px 6px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.count-semua { background: var(--gray-200); color: var(--gray-700); }
.count-baru { background: #ecfccb; color: #65a30d; } /* Hijau muda */
.count-repeat { background: #dcfce7; color: #15803d; } /* Hijau tua */
.count-loyal { background: #dbeafe; color: #1d4ed8; } /* Biru */
.count-prioritas { background: #f3e8ff; color: #7e22ce; } /* Ungu */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

.input-error {
    border-color: #ef4444 !important;
    animation: shake 0.3s ease-in-out;
}

.error-text {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.error-text a {
    color: #ef4444;
    text-decoration: underline;
    font-weight: 600;
}

/* -------- Section Title -------- */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 0 4px;
}

.section-title h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-700);
}

.count-badge {
    background: var(--green-100);
    color: var(--green-700);
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 99px;
}

/* -------- Customer Grid & Cards -------- */
.customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.customer-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 16px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Android Active Feedback */
.customer-card:active {
    transform: scale(0.98);
    background: var(--gray-50);
}

.customer-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-400), var(--green-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--white);
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.2);
}

.customer-info {
    flex: 1;
    min-width: 0;
}

.customer-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-sapaan {
    font-size: 10px;
    font-weight: 700;
    color: var(--green-700);
    background: var(--green-50);
    border: 1px solid var(--green-200);
    border-radius: 6px;
    padding: 1px 6px;
    display: inline-block;
    margin-bottom: 2px;
}

.customer-phone {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
}

.customer-arrow {
    color: var(--gray-300);
    font-size: 20px;
    font-weight: 300;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--gray-400);
}

.empty-state .empty-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite ease-in-out;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   DETAIL PAGE COMPONENTS
   ============================================ */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.back-btn:active {
    background: var(--gray-100);
}

.profile-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 20px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--green-50);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--green-600);
    border: 2px solid var(--green-200);
}

.profile-name {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-900);
}

.profile-name span.sapaan-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--green-700);
    background: var(--green-50);
    border: 1px solid var(--green-200);
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: 4px;
}

.profile-job {
    font-size: 13px;
    color: var(--gray-500);
}

.profile-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.detail-item {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1px solid var(--gray-100);
}

.detail-item .detail-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.detail-item .detail-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-800);
}

.detail-item .detail-value a {
    color: var(--green-600);
}

/* ============================================
   ORDERS LIST
   ============================================ */
.orders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.orders-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
}

.order-count-badge {
    background: var(--green-600);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 14px;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.order-item:active {
    transform: scale(0.98);
    background: var(--gray-50);
}

.order-date-badge {
    background: var(--green-50);
    color: var(--green-700);
    border: 1px solid var(--green-200);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    text-align: center;
    min-width: 52px;
    flex-shrink: 0;
}

.order-date-badge .day {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.order-date-badge .month {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.order-date-badge .year {
    font-size: 9px;
    opacity: 0.7;
}

.order-item-info {
    flex: 1;
    min-width: 0;
}

.order-address {
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-meta {
    font-size: 11px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.order-type-pill {
    background: var(--green-50);
    color: var(--green-700);
    border: 1px solid var(--green-200);
    border-radius: 99px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
}

.latest-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: var(--white);
    font-size: 9px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 99px;
    text-transform: uppercase;
}

.no-orders {
    text-align: center;
    padding: 32px 16px;
    color: var(--gray-400);
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1.5px dashed var(--gray-200);
    font-size: 13px;
}

/* ============================================
   BOTTOM NAVIGATION BAR & FAB (MOBILE BAR)
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 64px;
    padding: 0 16px;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
    border-top: 1px solid var(--gray-200);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--gray-400);
    font-size: 11px;
    font-weight: 600;
    width: 60px;
    transition: var(--transition);
}

.nav-item.active {
    color: var(--green-600);
}

/* Floating Action Button (FAB Android Style) */
.nav-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--green-500), var(--green-700));
    color: var(--white);
    border: none;
    border-radius: 18px;
    /* Material You Floating Style */
    cursor: pointer;
    box-shadow: var(--shadow-fab);
    margin-top: -24px;
    /* Floating Dock Effect */
    transition: var(--transition);
}

.nav-fab:active {
    transform: scale(0.92);
}

/* ============================================
   MODALS (ANDROID BOTTOM SHEET / CENTER DIALOG)
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: flex-end;
    /* Bottom sheet on mobile */
    justify-content: center;
    animation: fade-in 0.2s ease;
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: 20px;
    }
}

.modal-overlay.active {
    display: flex;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-box {
    background: var(--white);
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slide-up 0.25s cubic-bezier(0, 0, 0.2, 1);
}

@media (min-width: 640px) {
    .modal-box {
        border-radius: var(--radius-xl);
    }
}

@keyframes slide-up {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-100);
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    color: var(--gray-500);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.modal-body {
    padding: 20px;
}

.modal-field {
    margin-bottom: 14px;
}

.modal-field-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-400);
    margin-bottom: 4px;
}

.modal-field-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.modal-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 14px 0;
}

.btn-maps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--green-600);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

/* Forms Inside Modals */
.form-group {
    margin-bottom: 14px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-600);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.modal-footer {
    padding: 14px 20px 20px;
    display: flex;
    gap: 10px;
}

.btn-cancel {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-600);
    cursor: pointer;
}

.btn-submit {
    flex: 2;
    padding: 12px;
    background: var(--green-600);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-fab);
}

/* ============================================
   TOAST NOTIFICATIONS (SNACKBAR STYLE)
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

@media (min-width: 640px) {
    .toast-container {
        left: auto;
        right: 24px;
        width: 320px;
    }
}

.toast {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.25s cubic-bezier(0, 0, 0.2, 1);
}

.toast.success {
    background: var(--gray-900);
    border-left: 4px solid var(--green-500);
}

.toast.error {
    background: var(--gray-900);
    border-left: 4px solid #ef4444;
}

@keyframes toast-in {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Mobile Breakpoint Tweaks */
@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .profile-details {
        grid-template-columns: 1fr;
    }
}