/* === BEZORI HAYDOVCHI - Material Design 3 === */
:root {
  --md-primary: #1565C0;
  --md-primary-light: #1976D2;
  --md-secondary: #2E7D32;
  --md-surface: #FFFFFF;
  --md-background: #F5F7FA;
  --md-on-primary: #FFFFFF;
  --md-outline: #E0E0E0;
  --md-text: #1C1B1F;
  --md-text-secondary: #49454F;
  --md-error: #B00020;
  --md-success: #2E7D32;
  --md-warning: #F57C00;
  --md-info: #0277BD;
  --md-card-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --md-radius: 16px;
  --md-radius-sm: 8px;
  --green-btn: #4CAF50;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Roboto', 'Segoe UI', sans-serif;
  background: var(--md-background);
  color: var(--md-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; animation: fadeIn 0.3s ease;
}
.modal-card {
  background: #fff; border-radius: 24px; padding: 32px 28px;
  max-width: 380px; width: 90%; text-align: center;
  animation: slideUp 0.4s ease;
}
.modal-logo { font-size: 3rem; margin-bottom: 12px; }
.modal-title { font-size: 1.3rem; font-weight: 700; color: var(--md-primary); margin-bottom: 10px; }
.modal-body { font-size: 0.92rem; color: var(--md-text-secondary); line-height: 1.6; margin-bottom: 24px; }
.modal-institute { font-size: 0.8rem; color: #888; margin-top: 8px; }

/* APP LAYOUT */
.app-container { display: flex; flex-direction: column; min-height: 100vh; }

/* HEADER */
.app-header {
  background: var(--md-primary);
  color: #fff;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { font-size: 1.5rem; }
.header-title { font-size: 1.1rem; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.25); }

/* CONTENT */
.app-content { flex: 1; padding: 0 0 80px; }

/* BOTTOM NAV */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--md-outline);
  display: flex; z-index: 100; box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px; cursor: pointer; transition: color 0.2s;
  color: var(--md-text-secondary); border: none; background: none; font-family: inherit;
}
.nav-item.active { color: var(--md-primary); }
.nav-item .nav-icon { font-size: 1.4rem; }
.nav-item .nav-label { font-size: 0.7rem; margin-top: 2px; font-weight: 500; }

/* SCREENS */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.3s ease; }

/* HOME SCREEN */
.home-hero {
  background: linear-gradient(135deg, var(--md-primary), #0D47A1);
  color: #fff; padding: 24px 20px; text-align: center;
}
.home-hero h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.home-hero p { font-size: 0.9rem; opacity: 0.85; }

.section { padding: 16px 16px 0; }
.section-title { font-size: 0.85rem; font-weight: 600; color: var(--md-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }

.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.upload-btn {
  background: #fff; border: 2px dashed var(--md-outline); border-radius: var(--md-radius);
  padding: 24px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: all 0.2s; color: var(--md-text-secondary);
}
.upload-btn:hover { border-color: var(--md-primary); color: var(--md-primary); background: #EEF2FF; }
.upload-btn .btn-icon { font-size: 2rem; }
.upload-btn span { font-size: 0.85rem; font-weight: 600; }
.upload-btn input { display: none; }

.media-preview {
  background: #000; border-radius: var(--md-radius); overflow: hidden;
  margin-bottom: 16px; position: relative; display: none; max-height: 220px;
}
.media-preview img, .media-preview video { width: 100%; max-height: 220px; object-fit: cover; }
.preview-remove {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.6);
  color: #fff; border: none; border-radius: 50%; width: 30px; height: 30px;
  cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center;
}

.location-card {
  background: #fff; border-radius: var(--md-radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  box-shadow: var(--md-card-shadow); cursor: pointer;
}
.location-icon { font-size: 1.5rem; color: var(--md-primary); }
.location-info { flex: 1; }
.location-label { font-size: 0.75rem; color: var(--md-text-secondary); }
.location-value { font-size: 0.9rem; font-weight: 600; color: var(--md-text); }
.location-refresh { color: var(--md-primary); font-size: 1.1rem; }

.comment-input {
  width: 100%; border: 1.5px solid var(--md-outline); border-radius: var(--md-radius);
  padding: 14px 16px; font-size: 0.95rem; font-family: inherit;
  resize: none; outline: none; margin-bottom: 16px; min-height: 90px;
  transition: border-color 0.2s; background: #fff;
}
.comment-input:focus { border-color: var(--md-primary); }

.submit-btn {
  width: 100%; background: var(--green-btn); color: #fff;
  border: none; border-radius: 50px; padding: 16px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: all 0.2s; box-shadow: 0 4px 12px rgba(76,175,80,0.35);
  margin-bottom: 16px;
}
.submit-btn:hover { background: #43A047; transform: translateY(-1px); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* AUTH FORMS */
.auth-container {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px; background: var(--md-background);
}
.auth-card {
  background: #fff; border-radius: 24px; padding: 32px 28px;
  max-width: 400px; width: 100%; box-shadow: var(--md-card-shadow);
}
.auth-logo { text-align: center; font-size: 3rem; margin-bottom: 8px; }
.auth-title { text-align: center; font-size: 1.4rem; font-weight: 700; color: var(--md-primary); margin-bottom: 4px; }
.auth-subtitle { text-align: center; font-size: 0.85rem; color: var(--md-text-secondary); margin-bottom: 24px; }

.form-group { margin-bottom: 16px; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--md-text-secondary); margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; border: 1.5px solid var(--md-outline); border-radius: var(--md-radius-sm);
  padding: 12px 14px; font-size: 0.95rem; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--md-primary); }

.btn-primary {
  width: 100%; background: var(--md-primary); color: #fff;
  border: none; border-radius: 50px; padding: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.2s;
  margin-top: 8px;
}
.btn-primary:hover { background: #0D47A1; }
.btn-link {
  background: none; border: none; color: var(--md-primary);
  cursor: pointer; font-size: 0.9rem; text-decoration: underline;
}
.auth-divider { text-align: center; margin: 16px 0; color: var(--md-text-secondary); font-size: 0.85rem; }

/* REPORTS LIST */
.reports-list { padding: 0 16px; }
.report-card {
  background: #fff; border-radius: var(--md-radius); margin-bottom: 12px;
  box-shadow: var(--md-card-shadow); overflow: hidden; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.report-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.report-card-inner { display: flex; gap: 12px; padding: 14px; }
.report-thumb {
  width: 80px; height: 70px; border-radius: var(--md-radius-sm);
  object-fit: cover; flex-shrink: 0; background: #f0f0f0;
}
.report-thumb-placeholder {
  width: 80px; height: 70px; border-radius: var(--md-radius-sm);
  background: #f0f0f0; display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; flex-shrink: 0;
}
.report-info { flex: 1; min-width: 0; }
.report-comment { font-size: 0.9rem; font-weight: 600; color: var(--md-text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-date { font-size: 0.75rem; color: var(--md-text-secondary); margin-bottom: 8px; }

.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.status-tekshirilmoqda { background: #FFF3E0; color: #E65100; }
.status-korib_chiqildi { background: #E8F5E9; color: #1B5E20; }
.status-rad_etildi { background: #FFEBEE; color: #B71C1C; }

/* SETTINGS */
.settings-list { padding: 16px; }
.settings-item {
  background: #fff; border-radius: var(--md-radius); padding: 16px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 14px;
  box-shadow: var(--md-card-shadow); cursor: pointer;
}
.settings-icon { font-size: 1.4rem; width: 36px; text-align: center; }
.settings-label { flex: 1; font-size: 0.95rem; font-weight: 500; }
.settings-value { font-size: 0.85rem; color: var(--md-text-secondary); }
.toggle-switch { position: relative; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: #ccc; border-radius: 26px;
  cursor: pointer; transition: 0.3s;
}
.toggle-slider:before {
  content: ''; position: absolute; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s;
}
input:checked + .toggle-slider { background: var(--md-primary); }
input:checked + .toggle-slider:before { transform: translateX(22px); }

/* SUCCESS SCREEN */
.success-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center;
}
.success-icon { font-size: 5rem; color: var(--green-btn); margin-bottom: 20px; animation: pulse 1s ease; }
.success-title { font-size: 1.5rem; font-weight: 700; color: var(--md-text); margin-bottom: 10px; }
.success-subtitle { font-size: 0.95rem; color: var(--md-text-secondary); line-height: 1.6; margin-bottom: 32px; }
.btn-secondary {
  background: #fff; color: var(--md-primary); border: 2px solid var(--md-primary);
  border-radius: 50px; padding: 14px 32px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { background: #EEF2FF; }

/* INSTALL BANNER */
.install-banner {
  position: fixed; bottom: 80px; left: 16px; right: 16px;
  background: var(--md-primary); color: #fff; border-radius: var(--md-radius);
  padding: 14px 16px; display: none; align-items: center; gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25); z-index: 200;
  animation: slideUp 0.4s ease;
}
.install-banner.show { display: flex; }
.install-text { flex: 1; font-size: 0.9rem; }
.install-text strong { display: block; font-size: 0.95rem; }
.install-actions { display: flex; gap: 8px; }
.btn-install {
  background: #fff; color: var(--md-primary); border: none;
  border-radius: 20px; padding: 8px 16px; font-size: 0.85rem; font-weight: 700; cursor: pointer;
}
.btn-dismiss { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 1.2rem; }

/* TOAST */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: #323232; color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 0.9rem; z-index: 9999; opacity: 0; pointer-events: none;
  transition: opacity 0.3s; white-space: nowrap; max-width: 90vw;
}
.toast.show { opacity: 1; }
.toast.success { background: #2E7D32; }
.toast.error { background: #B00020; }

/* EMPTY STATE */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; text-align: center; color: var(--md-text-secondary);
}
.empty-icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.4; }
.empty-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.empty-sub { font-size: 0.85rem; }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px) } to { opacity: 1; transform: translateY(0) } }
@keyframes pulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.1) } }

/* DETAIL VIEW */
.back-btn {
  background: none; border: none; color: var(--md-primary);
  font-size: 1rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px;
  padding: 16px; margin-bottom: 0;
}
.detail-media { width: 100%; max-height: 260px; object-fit: cover; }
.detail-body { padding: 16px; }
.detail-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.detail-row-icon { font-size: 1.2rem; color: var(--md-primary); margin-top: 2px; }
.detail-row-content { flex: 1; }
.detail-row-label { font-size: 0.75rem; color: var(--md-text-secondary); }
.detail-row-value { font-size: 0.95rem; font-weight: 500; }

/* Loader */
.loader {
  display: flex; align-items: center; justify-content: center; padding: 32px;
}
.spinner {
  width: 36px; height: 36px; border: 3px solid #f0f0f0;
  border-top-color: var(--md-primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* Login Screen */
#login-screen, #register-screen { 
  display: none; 
  position: fixed; inset: 0; z-index: 500; 
  background: var(--md-background); overflow-y: auto;
}
#login-screen.active, #register-screen.active { display: block; }
