/* ===== CSS VARIABLES ===== */
:root {
  --bg: #0f0f13;
  --surface: #18181f;
  --surface2: #22222c;
  --surface3: #2a2a37;
  --border: #2e2e3e;
  --accent: #e8c46a;
  --accent2: #c97b4b;
  --text: #e8e8f0;
  --text2: #9898b0;
  --text3: #5a5a72;
  --red: #e05a5a;
  --green: #5ae0a0;
  --blue: #5a9ae0;
  --purple: #9a5ae0;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ===== RESET ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; }

/* ===== TOP BAR ===== */
#top-bar {
  background: #0a0a0e;
  border-bottom: 1px solid var(--border);
  padding: 6px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
#top-bar .brand { display: flex; align-items: center; gap: 10px; }
#top-bar .brand .logo-icon { width: 28px; height: 28px; background: var(--accent); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
#top-bar .brand span { font-family: 'Playfair Display', serif; font-size: 16px; font-weight: 700; color: var(--accent); letter-spacing: 0.5px; }
#top-bar .datetime { font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text2); }

/* ===== ORG BAR ===== */
#org-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
#org-bar .org-identity { display: flex; align-items: center; gap: 12px; }
#org-bar .org-logo { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; border: 2px solid var(--border); }
#org-bar .org-logo-placeholder { width: 40px; height: 40px; border-radius: 8px; background: var(--surface3); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 18px; }
#org-bar .org-name { font-family: 'Playfair Display', serif; font-size: 18px; font-weight: 700; color: var(--text); }
#org-bar .sections-nav { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }
#org-bar .sections-nav button { background: none; border: none; color: var(--text2); cursor: pointer; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-family: 'DM Sans', sans-serif; transition: all 0.15s; }
#org-bar .sections-nav button:hover, #org-bar .sections-nav button.active { background: var(--surface3); color: var(--accent); }
#org-bar .user-actions { display: flex; align-items: center; gap: 8px; }
#org-bar .user-actions button { background: none; border: 1px solid var(--border); color: var(--text2); cursor: pointer; padding: 6px 14px; border-radius: 8px; font-size: 13px; font-family: 'DM Sans', sans-serif; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
#org-bar .user-actions button:hover { border-color: var(--accent); color: var(--accent); }
#org-bar .user-actions button.primary { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
#org-bar .user-actions button.primary:hover { background: #d4b05a; }

/* ===== MAIN LAYOUT ===== */
#main { display: flex; min-height: calc(100vh - 120px); }

/* ===== LEFT SIDEBAR ===== */
#sidebar {
  width: 220px; min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: sticky; top: 120px; height: calc(100vh - 120px); overflow-y: auto;
}
#sidebar .sidebar-section { padding: 0 12px 16px; }
#sidebar .sidebar-section-title { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); padding: 0 8px 8px; }
#sidebar .sidebar-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text2); transition: all 0.15s; font-size: 13px; }
#sidebar .sidebar-item:hover { background: var(--surface2); color: var(--text); }
#sidebar .sidebar-item.active { background: rgba(232,196,106,0.1); color: var(--accent); }
#sidebar .sidebar-item .icon { font-size: 16px; width: 20px; text-align: center; }
#sidebar .sidebar-item .count { margin-left: auto; background: var(--surface3); color: var(--text3); font-size: 11px; padding: 2px 6px; border-radius: 10px; font-family: 'DM Mono', monospace; }
#sidebar hr { border: none; border-top: 1px solid var(--border); margin: 8px 12px; }

/* ===== CONTENT ===== */
#content { flex: 1; padding: 24px; max-width: 900px; }

/* ===== RIGHT PANEL ===== */
#right-panel { width: 280px; min-width: 280px; padding: 16px; }
#right-panel .widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; }
#right-panel .widget-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); margin-bottom: 12px; }

/* ===== COMPLAINT CARDS ===== */
.complaint-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.15s;
  cursor: pointer;
}
.complaint-card:hover { border-color: var(--text3); }
.complaint-card .card-header { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.complaint-card .user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); flex-shrink: 0; }
.complaint-card .user-avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; background: var(--surface3); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; color: var(--text2); }
.complaint-card .card-meta { flex: 1; }
.complaint-card .card-meta .user-name { font-weight: 600; font-size: 13px; color: var(--text); }
.complaint-card .card-meta .card-date { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; }
.complaint-card .section-tag { background: rgba(232,196,106,0.15); color: var(--accent); font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 500; }
.complaint-card h3 { font-family: 'Playfair Display', serif; font-size: 16px; margin-bottom: 8px; color: var(--text); line-height: 1.4; }
.complaint-card p { color: var(--text2); font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.complaint-card .card-footer { display: flex; align-items: center; gap: 16px; font-size: 12px; color: var(--text3); }
.complaint-card .card-footer .stat { display: flex; align-items: center; gap: 4px; }
.complaint-card .card-footer .solved-badge { background: rgba(90,224,160,0.15); color: var(--green); border: 1px solid rgba(90,224,160,0.3); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.complaint-card .card-footer .unsolved-badge { background: rgba(224,90,90,0.15); color: var(--red); border: 1px solid rgba(224,90,90,0.3); padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.complaint-card .media-preview { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.complaint-card .media-preview img { width: 80px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal.wide { max-width: 700px; }
.modal h2 { font-family: 'Playfair Display', serif; font-size: 22px; margin-bottom: 4px; }
.modal .subtitle { color: var(--text2); font-size: 13px; margin-bottom: 24px; }
.modal-close { position: absolute; top: 20px; right: 20px; background: var(--surface2); border: 1px solid var(--border); color: var(--text2); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { color: var(--text); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); padding: 10px 14px; font-family: 'DM Sans', sans-serif; font-size: 14px;
  transition: border-color 0.15s; outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group select option { background: var(--surface2); }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { color: var(--red); font-size: 12px; margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn { padding: 10px 20px; border-radius: var(--radius); border: none; cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500; transition: all 0.15s; }
.btn-primary { background: var(--accent); color: #000; font-weight: 600; }
.btn-primary:hover { background: #d4b05a; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text3); }
.btn-danger { background: rgba(224,90,90,0.15); color: var(--red); border: 1px solid rgba(224,90,90,0.3); }
.btn-danger:hover { background: rgba(224,90,90,0.25); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-group { display: flex; gap: 10px; margin-top: 8px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab { padding: 10px 16px; background: none; border: none; color: var(--text2); cursor: pointer; font-family: 'DM Sans', sans-serif; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.tab:hover:not(.active) { color: var(--text); }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-family: 'Playfair Display', serif; font-size: 26px; }
.page-header .actions { display: flex; gap: 10px; }

/* ===== PROFILE ===== */
.profile-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 16px; }
.profile-card .avatar-upload { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-card .avatar-preview { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border); }
.profile-card .avatar-preview-placeholder { width: 72px; height: 72px; border-radius: 50%; background: var(--surface3); border: 3px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--text2); }

/* ===== COMPLAINT DETAIL ===== */
.complaint-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.complaint-detail h2 { font-family: 'Playfair Display', serif; font-size: 24px; margin-bottom: 16px; line-height: 1.3; }
.comment-input { display: flex; gap: 12px; margin-top: 20px; }
.comment-input input { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: 24px; padding: 10px 16px; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px; outline: none; }
.comment-input input:focus { border-color: var(--accent); }
.comment { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }

/* ===== BADGES ===== */
.role-badge { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; padding: 2px 6px; border-radius: 4px; }
.role-admin { background: rgba(154,90,224,0.15); color: var(--purple); }
.role-listener { background: rgba(90,154,224,0.15); color: var(--blue); }
.role-complainer { background: rgba(232,196,106,0.15); color: var(--accent); }
.role-super { background: rgba(224,90,90,0.15); color: var(--red); }

/* ===== NOTIFICATIONS ===== */
#notification { position: fixed; bottom: 24px; right: 24px; z-index: 9999; max-width: 340px; }
.notif { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 18px; margin-top: 10px; box-shadow: var(--shadow); animation: slideIn 0.3s ease; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.notif.success { border-color: rgba(90,224,160,0.4); }
.notif.error { border-color: rgba(224,90,90,0.4); }
.notif.info { border-color: rgba(90,154,224,0.4); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== FOOTER ===== */
#footer { background: #0a0a0e; border-top: 1px solid var(--border); padding: 40px 24px 20px; margin-top: auto; }
#footer .footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
#footer .footer-brand .brand-name { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--accent); margin-bottom: 8px; }
#footer .footer-brand p { color: var(--text3); font-size: 13px; line-height: 1.6; margin-bottom: 16px; }
#footer .app-badges { display: flex; gap: 10px; flex-wrap: wrap; }
#footer .app-badge { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text2); cursor: pointer; transition: all 0.15s; }
#footer .app-badge:hover { border-color: var(--text3); color: var(--text); }
#footer .app-badge .store-icon { font-size: 20px; }
#footer .footer-col h4 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); margin-bottom: 12px; }
#footer .footer-col a { display: block; color: var(--text2); font-size: 13px; margin-bottom: 8px; text-decoration: none; transition: color 0.15s; cursor: pointer; }
#footer .footer-col a:hover { color: var(--accent); }
#footer .footer-bottom { border-top: 1px solid var(--border); padding-top: 20px; display: flex; align-items: center; justify-content: space-between; }
#footer .footer-bottom .copyright { color: var(--text3); font-size: 12px; font-family: 'DM Mono', monospace; }

/* ===== LOADING ===== */
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--surface3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-checking { background: rgba(232,196,106,0.08); border: 1px solid rgba(232,196,106,0.2); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; color: var(--accent); display: flex; align-items: center; gap: 10px; margin: 12px 0; }

/* ===== MISC ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--text2); margin-bottom: 8px; }
.empty-state p { font-size: 14px; line-height: 1.6; }
.text-accent { color: var(--accent); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }

/* ===== ORG SELECT PAGE ===== */
#org-select-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; background: var(--bg); }
#org-select-page h1 { font-family: 'Playfair Display', serif; font-size: 36px; color: var(--accent); margin-bottom: 8px; }
#org-select-page p { color: var(--text2); margin-bottom: 40px; font-size: 16px; }
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; width: 100%; max-width: 900px; margin-bottom: 24px; }
.org-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; cursor: pointer; transition: all 0.2s; text-align: center; }
.org-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.org-card .org-card-logo { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; margin: 0 auto 12px; border: 2px solid var(--border); }
.org-card .org-card-logo-ph { width: 64px; height: 64px; border-radius: 12px; background: var(--surface3); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 12px; }
.org-card h3 { font-family: 'Playfair Display', serif; font-size: 16px; margin-bottom: 4px; }
.org-card p { color: var(--text3); font-size: 12px; }
.subdomain-badge { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text3); background: var(--surface2); padding: 3px 8px; border-radius: 4px; margin-top: 6px; display: inline-block; }

/* ===== ADMIN ===== */
.user-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 8px; background: var(--surface2); }
.user-row .user-avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.user-row .user-info { flex: 1; }
.user-row .user-info .name { font-size: 13px; font-weight: 600; }
.user-row .user-info .email { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.stat-card .stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-card .stat-value { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card .stat-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ===== FILE UPLOAD ===== */
.file-upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; cursor: pointer; transition: all 0.15s; color: var(--text3); font-size: 13px; }
.file-upload-zone:hover { border-color: var(--accent); color: var(--text2); }
.file-upload-zone input { display: none; }

/* ===== MEDIA ===== */
.media-gallery { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.media-gallery img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.media-gallery .video-thumb { width: 120px; height: 90px; background: var(--surface3); border-radius: 8px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--text2); }

/* ===== SEARCH ===== */
.search-bar { position: relative; margin-bottom: 20px; }
.search-bar input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 10px 16px 10px 42px; color: var(--text); font-family: 'DM Sans', sans-serif; font-size: 14px; outline: none; }
.search-bar input:focus { border-color: var(--accent); }
.search-bar .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 16px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #sidebar { display: none; }
  #right-panel { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  #footer .footer-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  #org-bar .sections-nav { display: none; }
}
