* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #f0f2f5;
    --sidebar-bg: #0f1119;
    --sidebar-hover: #1a1f33;
    --card-bg: #ffffff;
    --text: #1a1d2e;
    --text-secondary: #65676b;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e4e6eb;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    --transition: 0.2s ease;
}

html, body { height: 100%; overflow: hidden; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    position: relative;
    transition: background 0.3s, color 0.3s;
}

body.dark-theme {
    --bg: #0f1119;
    --sidebar-bg: #07080d;
    --sidebar-hover: #1a1f33;
    --card-bg: #1a1d2e;
    --text: #e4e6eb;
    --text-secondary: #9ca3af;
    --border: #2d3148;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

/* САЙДБАР */
.sidebar {
    width: 260px; min-width: 260px;
    background: linear-gradient(180deg, #0f1119 0%, #161b2e 100%);
    color: #fff; padding: 16px 10px;
    position: fixed; left: 0; top: 0; bottom: 0; overflow-y: auto;
    z-index: 100; transition: transform 0.25s ease;
    display: flex; flex-direction: column; gap: 10px;
    border-right: 1px solid rgba(255,255,255,0.05);
}
body.dark-theme .sidebar { background: linear-gradient(180deg, #07080d 0%, #0f1119 100%); }

.sidebar-header { text-align: center; padding: 6px 0 14px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-header h2 { font-size: 18px; font-weight: 700; background: linear-gradient(135deg, #818cf8, #6366f1); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sidebar-city { font-size: 10px; color: rgba(255,255,255,0.35); margin-top: 2px; text-transform: uppercase; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); color: rgba(255,255,255,0.55); font-size: 13px; font-weight: 500; cursor: pointer; transition: all var(--transition); white-space: nowrap; position: relative; }
.sidebar-nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav a.active { background: rgba(99, 102, 241, 0.15); color: #fff; font-weight: 600; }

.sidebar-footer { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-online { text-align: center; font-size: 10px; color: rgba(255,255,255,0.5); padding: 4px; }
.sidebar-footer select { width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); color: #fff; font-size: 12px; outline: none; cursor: pointer; }
.sidebar-footer select option { background: #161b2e; color: #fff; }
.sidebar-weather { text-align: center; font-size: 10px; color: rgba(255,255,255,0.4); padding: 4px; }

/* БУРГЕР */
.menu-btn { display: none; position: fixed; top: 12px; left: 12px; z-index: 200; background: var(--card-bg); color: var(--text); border: 1px solid var(--border); width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; box-shadow: var(--shadow-md); display: flex; align-items: center; justify-content: center; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; backdrop-filter: blur(2px); }
.overlay.active { display: block; }

/* ОСНОВНАЯ ОБЛАСТЬ */
.main { margin-left: 260px; flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(255,255,255,0.7); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
body.dark-theme .topbar { background: rgba(15, 17, 25, 0.8); border-bottom: 1px solid #2d3148; }
.topbar h3 { font-size: 17px; font-weight: 700; }
.city-badge { font-size: 10px; color: var(--accent); background: rgba(99, 102, 241, 0.08); padding: 4px 10px; border-radius: 20px; border: 1px solid rgba(99, 102, 241, 0.15); }
.content { flex: 1; overflow-y: auto; padding: 8px 16px 16px; -webkit-overflow-scrolling: touch; }

.card { background: var(--card-bg); padding: 14px; border-radius: var(--radius); margin-bottom: 8px; border: 1px solid var(--border); box-shadow: var(--shadow); transition: all var(--transition); overflow: hidden; }
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.card h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 3px; }
.card .price { font-weight: 700; color: var(--success); font-size: 16px; }
.card .contact { color: var(--accent); font-weight: 600; }
.card .meta { font-size: 10px; color: #9ca3af; margin-top: 4px; }
.card-photo { width: 100%; height: 160px; overflow: hidden; border-radius: var(--radius-sm) var(--radius-sm) 0 0; margin: -14px -14px 10px -14px; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-bottom: 10px; }
.photos-grid img { width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius-sm); }

input, textarea, select, button { width: 100%; padding: 10px 12px; margin: 3px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font); outline: none; background: var(--card-bg); color: var(--text); transition: all var(--transition); }
body.dark-theme input, body.dark-theme textarea, body.dark-theme select { background: #131620; border-color: #2d3148; color: #e4e6eb; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea { resize: vertical; min-height: 80px; }
button { background: var(--accent); color: #fff; border: none; cursor: pointer; font-weight: 600; padding: 10px 16px; }
button:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
button.secondary { background: #f3f4f6; color: var(--text); border: 1px solid var(--border); }
body.dark-theme button.secondary { background: #2d3148; color: #e4e6eb; border-color: #3d4268; }

.chat-wrapper { display: flex; flex-direction: column; height: calc(100vh - 120px); }
.chat-box { flex: 1; overflow-y: auto; background: #f8f9fb; padding: 10px; border-radius: var(--radius); margin-bottom: 8px; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
body.dark-theme .chat-box { background: #131620; border-color: #2d3148; }
.chat-msg { padding: 8px 10px; background: #fff; border-radius: var(--radius-sm); max-width: 90%; align-self: flex-start; box-shadow: var(--shadow); }
body.dark-theme .chat-msg { background: #1a1d2e; border-color: #2d3148; }
.chat-msg .user { font-weight: 600; color: var(--accent); font-size: 11px; }
.chat-msg .text { font-size: 13px; color: var(--text); }
.chat-msg .time { font-size: 9px; color: #cbd5e1; float: right; }
.chat-input-row { display: flex; gap: 6px; }
.chat-input-row input { flex: 1; border-radius: 24px; padding: 10px 16px; background: #f3f4f6; border: 1px solid transparent; }
body.dark-theme .chat-input-row input { background: #131620; }
.chat-input-row button { width: 42px; height: 42px; border-radius: 50%; padding: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }

.profile-info { text-align: center; padding: 16px; }
.profile-avatar { width: 70px; height: 70px; background: linear-gradient(135deg, #6366f1, #818cf8); border-radius: 50%; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; font-size: 30px; color: #fff; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3); background-size: cover; background-position: center; }
.profile-info h3 { font-size: 17px; margin-bottom: 2px; font-weight: 700; }
.profile-info p { font-size: 13px; color: var(--text-secondary); }

.toast-container { position: fixed; top: 16px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; max-width: 320px; }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); color: #fff; font-size: 13px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.2); animation: slideIn 0.3s ease; cursor: pointer; }
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-info { background: #6366f1; }
.toast-warning { background: #f59e0b; color: #1a1d2e; }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.loading { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 400px 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius); height: 60px; }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.5); }
    .main { margin-left: 0; }
    .menu-btn { display: flex; }
    .topbar { padding-left: 56px; }
    .chat-wrapper { height: calc(100vh - 140px); }
    .card { padding: 12px; }
    .card-photo { margin: -12px -12px 8px -12px; height: 140px; }
}