/* ============================================
   Taawun PWA - Islamic Modern Design System
   "Saling Bantu, Saling Berbagi"
   ============================================ */

/* ---------- CSS Variables (Design Tokens) ---------- */
:root {
    /* Primary Palette - Islamic Emerald */
    --emerald-900: #064e3b;
    --emerald-800: #065f46;
    --emerald-700: #047857;
    --emerald-600: #059669;
    --emerald-500: #10b981;
    --emerald-400: #34d399;
    --emerald-300: #6ee7b7;
    --emerald-200: #a7f3d0;
    --emerald-100: #d1fae5;
    --emerald-50: #ecfdf5;

    /* Gold Accent */
    --gold-600: #b8860b;
    --gold-500: #d4a853;
    --gold-400: #e2c07c;
    --gold-300: #f0d9a0;
    --gold-200: #f5e6c4;
    --gold-100: #faf0dc;

    /* Neutrals */
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-gold: 0 4px 14px rgba(212, 168, 83, 0.25);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transition */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;

    /* Z-index */
    --z-navbar: 100;
    --z-modal: 200;
    --z-toast: 300;

    /* Spacing */
    --nav-height: 72px;
    --header-height: 60px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + 16px);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ---------- Islamic Geometric Pattern BG ---------- */
.pattern-bg {
    position: relative;
    overflow: hidden;
}

.pattern-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.08) 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 0;
}

.pattern-bg > * {
    position: relative;
    z-index: 1;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.3;
}

.heading-xl { font-size: 2rem; }
.heading-lg { font-size: 1.5rem; }
.heading-md { font-size: 1.25rem; }
.heading-sm { font-size: 1.1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--gray-500); }
.text-emerald { color: var(--emerald-700); }
.text-gold { color: var(--gold-500); }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ---------- Container ---------- */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 16px;
}

.container-wide {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- Header / Top Bar ---------- */
.top-header {
    background: linear-gradient(135deg, var(--emerald-900), var(--emerald-700));
    color: var(--white);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: var(--z-navbar);
    box-shadow: var(--shadow-md);
}

.top-header-inner {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.top-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-header .logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.top-header .logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.top-header .logo-slogan {
    font-size: 0.65rem;
    opacity: 0.75;
    display: block;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    transition: var(--transition-fast);
    position: relative;
}

.header-btn:hover {
    background: rgba(255,255,255,0.22);
}

.header-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--gold-500);
    border-radius: 50%;
    border: 2px solid var(--emerald-900);
}

/* ---------- Bottom Navigation ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 4px 8px 12px;
    z-index: var(--z-navbar);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    color: var(--gray-400);
    transition: var(--transition-fast);
    font-size: 0.65rem;
    font-weight: 500;
    position: relative;
    min-width: 56px;
}

.nav-item.active {
    color: var(--emerald-700);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--emerald-700);
    border-radius: 0 0 3px 3px;
}

.nav-item svg {
    width: 22px;
    height: 22px;
}

.nav-post .nav-post-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--emerald-600), var(--emerald-800));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    margin-top: -20px;
    box-shadow: 0 4px 15px rgba(6, 78, 59, 0.35);
    transition: var(--transition);
}

.nav-post:hover .nav-post-btn {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(6, 78, 59, 0.45);
}

.nav-icon-wrapper {
    position: relative;
}

.badge-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--emerald-700), var(--emerald-900));
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(6, 78, 59, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
    color: var(--white);
    box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
    box-shadow: 0 6px 20px rgba(212, 168, 83, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--emerald-700);
    border: 2px solid var(--emerald-300);
}

.btn-outline:hover {
    background: var(--emerald-50);
    border-color: var(--emerald-500);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
}

.btn-ghost:hover {
    background: var(--gray-100);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.05rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ---------- Cards ---------- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 16px;
}

/* ---------- Item Card ---------- */
.item-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.item-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.item-card:active {
    transform: translateY(0);
}

.item-card-img {
    position: relative;
    height: 180px;
    background: var(--gray-100);
    overflow: hidden;
}

.item-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.item-card:hover .item-card-img img {
    transform: scale(1.05);
}

.item-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
}

.item-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    backdrop-filter: blur(10px);
}

.badge-hibah {
    background: rgba(6, 78, 59, 0.88);
    color: var(--white);
}

.badge-kesepakatan {
    background: rgba(212, 168, 83, 0.9);
    color: var(--white);
}

.item-distance {
    position: absolute;
    bottom: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.55);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    backdrop-filter: blur(4px);
}

.item-card-body {
    padding: 12px 14px 14px;
}

.item-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-card-price {
    color: var(--gold-600);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.item-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.item-card-user {
    display: flex;
    align-items: center;
    gap: 6px;
}

.item-card-username {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
}

.item-card-location {
    font-size: 0.7rem;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

/* ---------- Avatar ---------- */
.avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--emerald-400), var(--emerald-600));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-sm span {
    color: var(--white);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.avatar-md {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--emerald-400), var(--emerald-600));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 1.2rem;
    color: var(--white);
    font-weight: 700;
}

.avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--emerald-400), var(--emerald-700));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 2rem;
    color: var(--white);
    font-weight: 700;
    border: 4px solid var(--white);
    box-shadow: var(--shadow-md);
}

.avatar-lg img,
.avatar-md img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Items Grid ---------- */
.items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px 0;
}

@media (max-width: 360px) {
    .items-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--gray-800);
    background: var(--white);
    transition: var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--emerald-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ---------- Radio Group (Hybrid Pricing) ---------- */
.radio-group {
    display: flex;
    gap: 12px;
}

.radio-card {
    flex: 1;
    position: relative;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-card-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.radio-card input:checked + .radio-card-label {
    border-color: var(--emerald-500);
    background: var(--emerald-50);
}

.radio-card-label .radio-icon {
    font-size: 1.5rem;
}

.radio-card-label .radio-title {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.radio-card-label .radio-desc {
    font-size: 0.72rem;
    color: var(--gray-500);
}

/* ---------- Image Upload ---------- */
.image-upload {
    position: relative;
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--gray-50);
    overflow: hidden;
}

.image-upload:hover {
    border-color: var(--emerald-400);
    background: var(--emerald-50);
}

.image-upload.has-preview {
    padding: 0;
    border-style: solid;
    border-color: var(--emerald-400);
}

.image-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-upload-icon {
    color: var(--gray-400);
    margin-bottom: 8px;
}

.image-upload-text {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.image-upload-text strong {
    color: var(--emerald-600);
}

.image-preview {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: none;
}

.image-upload.has-preview .image-preview {
    display: block;
}

.image-upload.has-preview .image-upload-icon,
.image-upload.has-preview .image-upload-text {
    display: none;
}

/* ---------- Hero Section ---------- */
.hero {
    background: linear-gradient(135deg, var(--emerald-900) 0%, var(--emerald-700) 50%, var(--emerald-600) 100%);
    color: var(--white);
    padding: 28px 20px 32px;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '☪';
    position: absolute;
    top: -20px;
    right: -10px;
    font-size: 120px;
    opacity: 0.04;
    transform: rotate(15deg);
}

.hero-greeting {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 4px;
}

.hero-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--white);
}

.hero-title span {
    color: var(--gold-400);
}

/* ---------- Search Bar ---------- */
.search-bar {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    padding: 4px 6px 4px 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.15);
    transition: var(--transition);
}

.search-bar:focus-within {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.3);
}

.search-bar input {
    flex: 1;
    background: none;
    border: none;
    color: var(--white);
    font-size: 0.9rem;
    outline: none;
    padding: 8px 0;
}

.search-bar input::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-bar button {
    width: 36px;
    height: 36px;
    background: var(--gold-500);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.search-bar button:hover {
    background: var(--gold-600);
}

/* ---------- Category Filter Chips ---------- */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 16px 16px 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1.5px solid var(--gray-200);
    background: var(--white);
    color: var(--gray-600);
    transition: var(--transition-fast);
    cursor: pointer;
}

.chip.active {
    background: var(--emerald-700);
    color: var(--white);
    border-color: var(--emerald-700);
}

.chip:hover:not(.active) {
    border-color: var(--emerald-400);
    color: var(--emerald-700);
}

/* ---------- Section Header ---------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 0;
}

.section-header h2 {
    font-size: 1.1rem;
}

.section-header a {
    font-size: 0.8rem;
    color: var(--emerald-600);
    font-weight: 600;
}

/* ---------- Chat Styles ---------- */
.chat-list {
    padding: 0;
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition-fast);
}

.chat-list-item:hover {
    background: var(--gray-50);
}

.chat-list-item.unread {
    background: var(--emerald-50);
}

.chat-list-content {
    flex: 1;
    min-width: 0;
}

.chat-list-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}

.chat-list-preview {
    font-size: 0.82rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-list-meta {
    text-align: right;
    flex-shrink: 0;
}

.chat-list-time {
    font-size: 0.7rem;
    color: var(--gray-400);
}

.chat-list-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-top: 4px;
    background: var(--emerald-600);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    padding: 0 5px;
}

/* Chat detail */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height) - var(--nav-height));
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-bubble-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
}

.chat-bubble-wrapper.mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-bubble-wrapper.other {
    align-self: flex-start;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    max-width: 100%;
    word-wrap: break-word;
}

.chat-bubble-mine {
    background: linear-gradient(135deg, var(--emerald-700), var(--emerald-800));
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.chat-bubble-other {
    background: var(--white);
    color: var(--gray-800);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
}

.chat-text {
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-time {
    font-size: 0.65rem;
    opacity: 0.6;
    display: block;
    margin-top: 4px;
    text-align: right;
}

.chat-avatar {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

/* Chat input */
.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.chat-input-bar input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
}

.chat-input-bar input:focus {
    border-color: var(--emerald-400);
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--emerald-600), var(--emerald-800));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

/* ---------- Profile Styles ---------- */
.profile-header {
    background: linear-gradient(135deg, var(--emerald-900), var(--emerald-700));
    color: var(--white);
    padding: 32px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.profile-header::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: -10%;
    right: -10%;
    height: 60px;
    background: var(--gray-50);
    border-radius: 50% 50% 0 0;
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 800;
    margin-top: 12px;
    color: var(--white);
}

.profile-email {
    font-size: 0.82rem;
    opacity: 0.75;
    margin-top: 2px;
}

.karma-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-full);
    margin-top: 12px;
    font-size: 0.82rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.karma-badge .karma-icon {
    font-size: 1.1rem;
}

.profile-stats {
    display: flex;
    gap: 2px;
    margin: -20px 16px 16px;
    position: relative;
    z-index: 1;
}

.stat-card {
    flex: 1;
    background: var(--white);
    padding: 16px 12px;
    text-align: center;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.stat-card:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.stat-card:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.stat-number {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--emerald-700);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    background: var(--white);
    padding: 14px 18px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: toastIn 0.35s ease;
    border-left: 4px solid var(--emerald-500);
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }

.toast-exit {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    padding: 24px;
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 0 auto 16px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ---------- Empty State ---------- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.empty-state-desc {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 20px;
}

/* ---------- Loading Skeleton ---------- */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 260px;
    border-radius: var(--radius-lg);
}

/* ---------- Leaderboard ---------- */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.leaderboard-rank {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.leaderboard-rank.gold {
    background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
    color: var(--white);
}

.leaderboard-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
    color: var(--white);
}

.leaderboard-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #b5651d);
    color: var(--white);
}

.leaderboard-rank.normal {
    background: var(--gray-200);
    color: var(--gray-600);
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.leaderboard-donated {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.leaderboard-score {
    font-weight: 800;
    color: var(--emerald-700);
    font-size: 1rem;
}

/* ---------- Item Detail ---------- */
.detail-image {
    width: 100%;
    height: 280px;
    object-fit: cover;
}

.detail-back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.4);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    z-index: 2;
}

/* ---------- Auth Pages ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--emerald-900) 0%, var(--emerald-800) 40%, var(--gray-50) 40%);
}

.auth-header {
    text-align: center;
    padding: 48px 24px 40px;
    color: var(--white);
}

.auth-logo {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 4px;
    letter-spacing: -1px;
}

.auth-slogan {
    font-size: 0.82rem;
    opacity: 0.75;
}

.auth-form-card {
    background: var(--white);
    margin: 0 16px;
    padding: 28px 24px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    margin-top: -16px;
}

.auth-form-card h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.2rem;
}

.auth-divider {
    text-align: center;
    margin: 24px 0;
    color: var(--gray-500);
    font-size: 0.85rem;
}

.auth-switch {
    text-align: center;
    padding: 24px;
    font-size: 0.85rem;
    color: var(--gray-500);
}

.auth-switch a {
    color: var(--emerald-600);
    font-weight: 600;
}

/* ---------- Karma History ---------- */
.karma-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.karma-history-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--emerald-100);
    color: var(--emerald-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.karma-history-info {
    flex: 1;
}

.karma-history-reason {
    font-size: 0.85rem;
    font-weight: 500;
}

.karma-history-date {
    font-size: 0.72rem;
    color: var(--gray-400);
}

.karma-history-points {
    font-weight: 800;
    color: var(--emerald-600);
    font-size: 0.9rem;
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ---------- Page Transition ---------- */
.page-content {
    animation: pageFadeIn 0.3s ease;
}

@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Spinner ---------- */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--emerald-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .items-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
