/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #e91e63;
    --primary-dark: #c2185b;
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16213e;
    --text: #eee;
    --text-muted: #999;
    --border: #2a2a4a;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --radius: 12px;
    --radius-sm: 8px;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.85; }
img { max-width: 100%; height: auto; display: block; }

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* === Header === */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    padding: 12px 0;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; }
.logo { font-size: 1.4rem; font-weight: 700; color: #fff; }
.logo span { color: var(--primary); }

.nav { display: flex; gap: 16px; }
.nav a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.nav a:hover { color: #fff; }

.nav-toggle {
    display: none; background: none; border: none; cursor: pointer;
    flex-direction: column; gap: 4px; padding: 8px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: #fff; }

@media (max-width: 640px) {
    .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); flex-direction: column; padding: 16px; border-bottom: 1px solid var(--border); }
    .nav.open { display: flex; }
    .nav-toggle { display: flex; }
}

/* === Alerts === */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin: 16px 0; font-size: 0.9rem; }
.alert-success { background: rgba(76,175,80,0.15); border: 1px solid var(--success); color: var(--success); }
.alert-error { background: rgba(244,67,54,0.15); border: 1px solid var(--danger); color: var(--danger); }

/* === Hero === */
.hero { text-align: center; padding: 40px 16px 24px; }
.hero h1 { font-size: 1.8rem; margin-bottom: 8px; }
.hero p { color: var(--text-muted); }

/* === Cities Bar === */
.cities-bar {
    display: flex; gap: 8px; overflow-x: auto; padding: 12px 0;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cities-bar::-webkit-scrollbar { display: none; }
.city-pill {
    flex-shrink: 0; padding: 8px 16px; border-radius: 20px;
    background: var(--bg-card); color: var(--text-muted); font-size: 0.85rem;
    border: 1px solid var(--border); white-space: nowrap;
}
.city-pill:hover, .active-pill { background: var(--primary); color: #fff; border-color: var(--primary); }
.city-count { opacity: 0.7; font-size: 0.8em; }

/* === Search Bar === */
.search-bar { padding: 12px 0; }
.search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-check { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; cursor: pointer; }
.input-sort { width: auto; min-width: 100px; }

/* === Inputs === */
.input-text, .input-search, .input-select, .input-small {
    background: var(--bg-input); border: 1px solid var(--border); color: var(--text);
    padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.95rem;
    width: 100%; outline: none; transition: border-color 0.2s;
}
.input-text:focus, .input-search:focus, .input-select:focus { border-color: var(--primary); }
.input-small { width: 80px; }
.input-select { appearance: none; cursor: pointer; }
.input-file { color: var(--text-muted); font-size: 0.9rem; }
textarea.input-text { resize: vertical; }

/* === Buttons === */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 0.95rem;
    font-weight: 600; border: none; cursor: pointer; transition: all 0.2s;
    text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--text); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-search { flex-shrink: 0; }
.btn-loc {
    flex-shrink: 0; background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-muted); padding: 10px; border-radius: var(--radius-sm); cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.btn-loc:hover { border-color: var(--primary); color: var(--primary); }
.btn-loc-active { border-color: var(--success); color: var(--success); }
.btn-loc-loading { opacity: 0.5; animation: pulse 1s infinite; }
.btn-loc-error { border-color: var(--danger); color: var(--danger); }
@keyframes pulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.btn-back { color: #fff; font-size: 1.3rem; padding: 4px 8px; }

/* === Profile Grid === */
.profile-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px; padding: 16px 0;
}
.profile-card {
    background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border); transition: transform 0.2s, box-shadow 0.2s;
}
.profile-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }

.card-img { position: relative; aspect-ratio: 3/4; overflow: hidden; background: var(--bg-input); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img-placeholder { width: 100%; height: 100%; background: var(--bg-input); }

.status-dot {
    position: absolute; bottom: 8px; right: 8px;
    width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid var(--bg-card);
}
.status-online { background: var(--success); }
.status-offline { background: #666; }
.status-busy { background: var(--danger); }
.status-away { background: var(--warning); }

.card-body { padding: 10px 12px; }
.card-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 2px; color: #fff; display: flex; align-items: center; gap: 4px; }
.card-meta { font-size: 0.8rem; color: var(--text-muted); }
.card-tagline { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-distance { font-size: 0.75rem; color: var(--primary); margin-top: 2px; }

.badge-verified {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; width: 18px; height: 18px;
    border-radius: 50%; font-size: 0.65rem; flex-shrink: 0;
}

/* === Status Badge === */
.status-badge {
    display: inline-block; padding: 4px 10px; border-radius: 12px;
    font-size: 0.8rem; font-weight: 500;
}
.status-badge.status-online { background: rgba(76,175,80,0.2); color: var(--success); }
.status-badge.status-offline { background: rgba(102,102,102,0.2); color: #999; }
.status-badge.status-busy { background: rgba(244,67,54,0.2); color: var(--danger); }
.status-badge.status-away { background: rgba(255,152,0,0.2); color: var(--warning); }

/* === Profile Page === */
.profile-page { padding: 16px 0; }
.profile-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 20px; }
.gallery-item { aspect-ratio: 3/4; border-radius: var(--radius-sm); overflow: hidden; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-placeholder { background: var(--bg-card); border-radius: var(--radius-sm); padding: 40px; text-align: center; color: var(--text-muted); }

.profile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.profile-header h1 { font-size: 1.5rem; display: flex; align-items: center; gap: 8px; }
.profile-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 12px; }
.profile-tagline { font-size: 1.1rem; color: var(--text); margin-bottom: 16px; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tag { background: var(--bg-input); padding: 4px 12px; border-radius: 16px; font-size: 0.8rem; color: var(--text-muted); border: 1px solid var(--border); }
.profile-bio { margin-bottom: 24px; }
.profile-bio h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text-muted); }
.profile-actions { display: flex; flex-direction: column; gap: 8px; }
.last-active { font-style: italic; }

/* === Auth === */
.auth-page { max-width: 400px; margin: 40px auto; }
.auth-page h1 { text-align: center; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.auth-link { text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* === Dashboard === */
.dashboard { padding: 16px 0; }
.dashboard h1 { margin-bottom: 20px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.dash-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; transition: border-color 0.2s;
}
.dash-card h3 { font-size: 1rem; margin-bottom: 8px; }
.dash-card p { color: var(--text-muted); font-size: 0.9rem; }
.dash-card-link:hover { border-color: var(--primary); color: var(--text); }
.dash-count { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.dash-status { margin-top: 8px; }
.status-form { margin-bottom: 8px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.profile-form { display: flex; flex-direction: column; gap: 16px; max-width: 600px; }

/* === Photos === */
.upload-form { margin-bottom: 24px; display: flex; flex-direction: column; gap: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo-item { position: relative; aspect-ratio: 3/4; border-radius: var(--radius-sm); overflow: hidden; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-pending { opacity: 0.6; }
.photo-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: end;
}
.badge-primary { background: var(--primary); color: #fff; padding: 2px 8px; border-radius: 8px; font-size: 0.7rem; }
.badge-pending { background: var(--warning); color: #000; padding: 2px 8px; border-radius: 8px; font-size: 0.7rem; }

/* === Inbox === */
.inbox-list { display: flex; flex-direction: column; gap: 2px; }
.inbox-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; background: var(--bg-card); border-radius: var(--radius-sm);
    border: 1px solid var(--border); transition: border-color 0.2s;
}
.inbox-item:hover { border-color: var(--primary); color: var(--text); }
.inbox-item.unread { border-left: 3px solid var(--primary); }
.inbox-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.inbox-name { font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; gap: 8px; }
.inbox-preview { font-size: 0.85rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-time { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
.badge-unread { background: var(--primary); color: #fff; padding: 1px 7px; border-radius: 10px; font-size: 0.75rem; }

/* === Chat === */
.chat-page { display: flex; flex-direction: column; height: calc(100vh - 60px); max-width: 600px; margin: 0 auto; }
.chat-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.chat-header h2 { font-size: 1.1rem; }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; flex-direction: column; max-width: 80%; }
.msg-mine { align-self: flex-end; align-items: flex-end; }
.msg-theirs { align-self: flex-start; align-items: flex-start; }
.msg-bubble {
    padding: 10px 14px; border-radius: 16px; font-size: 0.95rem;
    word-break: break-word; line-height: 1.4;
}
.msg-mine .msg-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-theirs .msg-bubble { background: var(--bg-card); color: var(--text); border-bottom-left-radius: 4px; }
.msg-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

.chat-input {
    display: flex; gap: 8px; padding: 12px 16px;
    background: var(--bg-card); border-top: 1px solid var(--border); flex-shrink: 0;
}
.chat-input input { flex: 1; }

/* === Modal === */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px;
}
.modal-content {
    background: var(--bg-card); border-radius: var(--radius); padding: 24px;
    width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px;
}
.modal-actions { display: flex; gap: 8px; }

/* === Pagination === */
.pagination { display: flex; justify-content: center; gap: 4px; padding: 20px 0; }
.page-link {
    padding: 8px 14px; border-radius: var(--radius-sm); background: var(--bg-card);
    color: var(--text-muted); border: 1px solid var(--border); font-size: 0.9rem;
}
.page-link:hover, .page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* === Error Page === */
.error-page { text-align: center; padding: 60px 16px; }
.error-page h1 { font-size: 4rem; color: var(--primary); }
.error-page p { color: var(--text-muted); margin: 12px 0 24px; }

/* === Footer === */
.footer { text-align: center; padding: 24px 16px; color: var(--text-muted); font-size: 0.8rem; margin-top: 40px; border-top: 1px solid var(--border); }
.footer-links { margin-top: 4px; }
.footer-links a { color: var(--text-muted); }

/* === Utility === */
.inline-form { display: inline; }
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); grid-column: 1 / -1; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.mt-1 { margin-top: 12px; }

@media (max-width: 640px) {
    .profile-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .form-row { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .filter-row { gap: 6px; }
    .input-small { width: 70px; }
}
