/* Base Variables & Reset */
:root {
    --primary: #3b82f6;
    --bg-body: #e5e7eb;
    --bg-app: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --hover-bg: #f9fafb;
}
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-app);
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    display: none;
    padding: 20px;
    padding-bottom: 80px; /* Space for mobile nav */
    flex: 1;
    animation: fadeIn 0.3s ease;
}
.screen.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header & Navigation */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    z-index: 10;
}
.logo { font-size: 1.5rem; font-weight: bold; cursor: pointer; color: var(--primary); }

.desktop-nav { display: none; gap: 20px; align-items: center; }
.desktop-nav-item { cursor: pointer; font-weight: 500; padding: 8px 12px; border-radius: 8px; transition: background 0.2s; }
.desktop-nav-item:hover { background: var(--hover-bg); }
.desktop-nav-item.active { color: var(--primary); background: #eff6ff; }

.avatar-placeholder {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--text-main);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; cursor: pointer;
}

/* UI Elements */
.search-container { max-width: 600px; margin: 0 auto 20px auto; position: relative; }
.search-bar {
    width: 100%; padding: 12px 15px;
    border: 1px solid var(--border); border-radius: 25px;
    box-sizing: border-box; font-size: 1rem; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }

.section-title { font-size: 1.25rem; margin: 20px 0 15px 0; font-weight: 600; }

/* Pills & Toggles */
.pill-group { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.pill {
    padding: 8px 16px; border: 1px solid var(--border); border-radius: 20px;
    font-size: 0.9rem; cursor: pointer; background: #fff; transition: all 0.2s; user-select: none;
}
.pill:hover { background: var(--hover-bg); }
.pill.active { border-color: var(--primary); background-color: var(--primary); color: #fff; font-weight: bold; }

/* Content Grid */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr; /* Mobile default */
    gap: 15px;
}

/* Cards */
.card {
    border: 1px solid var(--border); border-radius: 12px;
    padding: 20px; background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.card-header { display: flex; justify-content: space-between; margin-bottom: 15px; align-items: flex-start; }
.card-user-info { display: flex; align-items: center; gap: 15px; }
.trade-tag { font-size: 0.8rem; color: var(--primary); background: #eff6ff; padding: 4px 8px; border-radius: 12px; margin-top: 5px; display: inline-block;}

.image-gallery { display: flex; gap: 10px; margin-bottom: 15px; overflow-x: auto; padding-bottom: 5px;}
.image-placeholder {
    min-width: 80px; height: 80px; background-color: var(--bg-body);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: var(--text-muted);
}

.btn {
    padding: 8px 16px; border: 1px solid var(--text-main); border-radius: 20px;
    background: transparent; cursor: pointer; font-size: 0.9rem; font-weight: 500;
    transition: all 0.2s;
}
.btn:hover { background: var(--text-main); color: #fff; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; width: 100%; padding: 12px; font-size: 1rem; }
.btn-primary:hover { background: #2563eb; }

/* Mobile Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 65px;
    border-top: 1px solid var(--border); background: #fff;
    display: flex; justify-content: space-around; align-items: center;
    z-index: 10; padding-bottom: env(safe-area-inset-bottom);
}
.nav-item { font-size: 1.5rem; cursor: pointer; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nav-item span { font-size: 0.7rem; font-weight: 500; }
.nav-item.active { color: var(--primary); }

/* Toast Notification */
.toast {
    position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
    background: var(--text-main); color: white; padding: 12px 24px;
    border-radius: 30px; font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: bottom 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 50; white-space: nowrap;
}
.toast.show { bottom: 90px; }

/* Profile Screen */
.profile-header-center { text-align: center; margin-bottom: 20px; }
.profile-avatar-large { width: 80px; height: 80px; font-size: 2rem; margin: 0 auto 15px auto; }
.counter-box { background: var(--hover-bg); border-radius: 12px; padding: 20px; text-align: center; margin: 25px 0; border: 1px solid var(--border); }
.counter-number { font-size: 2.5rem; font-weight: bold; color: var(--primary); transition: opacity 0.3s ease; }
.counter-loading { opacity: 0.35; }
.skeleton-box { border: 2px dashed var(--border); border-radius: 12px; padding: 40px; text-align: center; color: var(--text-muted); background: var(--hover-bg); margin-bottom: 20px; }

/* Card action row */
.card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}
.btn-contact {
    background: var(--text-main);
    color: white;
}

/* Auth Screens */
.auth-card {
    max-width: 420px;
    margin: 40px auto;
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.auth-link { color: var(--primary); cursor: pointer; font-weight: 500; }
.auth-link:hover { text-decoration: underline; }
.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-main);
}
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
.form-textarea { min-height: 100px; resize: vertical; }

/* Sign Out button */
.btn-signout { color: #ef4444; border-color: #ef4444; padding: 8px 24px; }
.btn-signout:hover { background: #ef4444; color: #fff; }

/* Tag editing in My Profile */
.tag-edit-area { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; }
.tag-edit-pill {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--primary); color: #fff;
    padding: 4px 10px; border-radius: 12px; font-size: 0.85rem;
}
.tag-remove-btn {
    background: none; border: none; color: #fff; cursor: pointer;
    font-size: 1rem; line-height: 1; padding: 0; opacity: 0.8;
}
.tag-remove-btn:hover { opacity: 1; }

/* ---------------------------
   RESPONSIVE DESKTOP STYLES
   --------------------------- */
@media (min-width: 768px) {
    .app-container { margin: 20px auto; border-radius: 16px; min-height: 90vh; overflow: hidden; }
    .screen { padding: 40px; padding-bottom: 40px; }
    .bottom-nav { display: none; }
    .desktop-nav { display: flex; }
    .grid-layout { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
    .search-screen-wrapper { max-width: 600px; margin: 0 auto; background: #fff; padding: 40px; border-radius: 16px; border: 1px solid var(--border); }
    .toast.show { bottom: 40px; }
}
