/* ===== ASOSIY SOZLAMALAR ===== */
:root {
  --red:      #c0392b;
  --red-dark: #7b241c;
  --red-mid:  #922b21;
  --red-lite: #e74c3c;
  --green:    #1e8449;
  --green-lt: #d5f5e3;
  --cream:    #fdf6ec;
  --dark:     #1a1a1a;
  --gray:     #6b7280;
  --gray-lt:  #f3f4f6;
  --border:   #e5e7eb;
  --warn:     #d4ac0d;
  --shadow:   0 4px 24px rgba(0,0,0,0.09);
}
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'DM Sans',sans-serif; background:var(--cream); color:var(--dark); min-height:100vh; }

/* ===== HEADER ===== */
header {
  background: var(--red-dark);
  color: white;
  padding: 0 28px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 16px rgba(0,0,0,0.22);
}
.logo { display:flex; align-items:center; gap:12px; }
.logo-icon {
  width: 40px; height: 40px;
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.logo-text { font-family:'Playfair Display',serif; font-size:22px; font-weight:900; }
.logo-sub { font-size:10px; opacity:0.7; letter-spacing:1.5px; text-transform:uppercase; }
.header-badge {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 20px;
  font-weight: 600;
}

/* ===== MAIN ===== */
main { max-width: 940px; margin: 0 auto; padding: 36px 20px 70px; }

/* ===== HERO ===== */
.hero { text-align:center; margin-bottom:36px; animation: fadeUp 0.6s ease both; }
.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(26px, 5vw, 42px);
  font-weight: 900;
  color: var(--red-dark);
  margin-bottom: 12px;
  line-height: 1.15;
}
.hero p { color:var(--gray); font-size:15px; max-width:520px; margin:0 auto; line-height:1.7; }

/* ===== UPLOAD CARD ===== */
.upload-card {
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeUp 0.7s 0.1s ease both;
}
.upload-tabs { display:flex; background:var(--gray-lt); border-bottom:1px solid var(--border); }
.tab-btn {
  flex: 1; padding: 15px;
  border: none; background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600;
  color: var(--gray); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}
.tab-btn.active { background:white; color:var(--red-dark); border-bottom-color:var(--red-dark); }
.upload-body { padding: 28px; }

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2.5px dashed var(--border);
  border-radius: 16px;
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: var(--gray-lt);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over { border-color:var(--red-lite); background:#fff5f5; }
.drop-zone input[type="file"] { position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; }
.drop-icon { font-size:54px; margin-bottom:14px; }
.drop-zone h3 { font-size:16px; font-weight:700; margin-bottom:8px; color:var(--dark); }
.drop-zone p { font-size:13px; color:var(--gray); margin-bottom:16px; }
.fmt-list { display:flex; gap:7px; justify-content:center; flex-wrap:wrap; }
.fmt-list span {
  background:white; border:1px solid var(--border);
  color:var(--gray); font-size:11px;
  padding:3px 10px; border-radius:20px; font-weight:700;
}

/* ===== CAMERA ===== */
.cam-box {
  border-radius:16px; overflow:hidden;
  background:#000; position:relative;
  aspect-ratio:4/3; max-height:360px;
  display:flex; align-items:center; justify-content:center;
}
#videoEl { width:100%; height:100%; object-fit:cover; }
.cam-overlay {
  position:absolute; inset:0;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  gap:14px; background:rgba(0,0,0,0.55);
}
.cam-overlay p { color:white; font-size:14px; }
.cam-actions { display:flex; gap:12px; margin-top:16px; justify-content:center; flex-wrap:wrap; }

/* ===== TUGMALAR ===== */
.btn-red {
  background: var(--red-dark); color: white;
  border: none; padding: 12px 26px;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-red:hover { background:var(--red-lite); transform:translateY(-1px); }
.btn-red:disabled { background:#ccc; cursor:not-allowed; transform:none; }
.btn-outline {
  background: white; color: var(--red-dark);
  border: 2px solid var(--red-dark);
  padding: 10px 22px; border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
}
.btn-outline:hover { background:#fff5f5; }

/* ===== PREVIEW ===== */
.preview-box {
  border-radius:16px; overflow:hidden;
  background:#000; text-align:center;
  max-height:340px;
  display:flex; align-items:center; justify-content:center;
  margin-bottom:12px;
}
#previewImg { max-width:100%; max-height:340px; object-fit:contain; }
.preview-meta { text-align:center; font-size:12px; color:var(--gray); margin-bottom:14px; }
.preview-actions { display:flex; gap:12px; justify-content:center; }

/* ===== ANALYZE BTN ===== */
#analyzeBtn {
  width: 100%;
  background: linear-gradient(135deg, var(--red-dark), var(--red-lite));
  color: white; border: none;
  padding: 17px;
  border-radius: 14px;
  font-family: 'Playfair Display', serif;
  font-size: 19px; font-weight: 700;
  cursor: pointer; transition: all 0.3s;
  margin-top: 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 5px 18px rgba(192,57,43,0.32);
  animation: pulse-glow 2.2s infinite;
}
#analyzeBtn:hover { transform:translateY(-2px); box-shadow:0 8px 28px rgba(192,57,43,0.46); }
#analyzeBtn:disabled { background:#ccc; transform:none; box-shadow:none; animation:none; }

/* ===== LOADING ===== */
.loading-card {
  text-align:center; padding:52px 20px;
  margin-top:24px;
  background:white; border-radius:20px;
  box-shadow: var(--shadow);
}
.spinner {
  width:58px; height:58px;
  border:4px solid var(--border);
  border-top-color:var(--red-dark);
  border-radius:50%;
  animation:spin 0.85s linear infinite;
  margin:0 auto 18px;
}
.load-title { font-size:17px; font-weight:700; margin-bottom:6px; }
.load-sub { font-size:13px; color:var(--gray); margin-bottom:22px; }
.load-steps { display:flex; justify-content:center; gap:24px; flex-wrap:wrap; }
.lstep {
  display:flex; align-items:center; gap:8px;
  font-size:13px; color:var(--gray);
  opacity:0.35; transition:opacity 0.4s;
}
.lstep.active { opacity:1; color:var(--red-dark); font-weight:700; }
.lstep.done { opacity:0.7; color:var(--green); }
.ldot { width:9px; height:9px; border-radius:50%; background:currentColor; display:inline-block; }

/* ===== ERROR ===== */
.error-card {
  background:#fef2f2; border:1px solid #fecaca;
  border-radius:18px; padding:32px;
  text-align:center; margin-top:24px;
}
.err-icon { font-size:40px; margin-bottom:12px; }
.error-card h3 { color:var(--red-dark); font-size:18px; margin-bottom:8px; }
.error-card p { color:var(--gray); font-size:14px; }

/* ===== RESULT ===== */
#resultSection { margin-top:28px; }
.res-card { border-radius:20px; overflow:hidden; box-shadow:var(--shadow); animation:fadeUp 0.5s ease; }
.res-header { padding:24px 28px; display:flex; align-items:center; gap:18px; }
.res-header.disease { background:linear-gradient(135deg,#7b241c,#c0392b); color:white; }
.res-header.healthy { background:linear-gradient(135deg,#145a32,#1e8449); color:white; }
.res-header.unknown { background:linear-gradient(135deg,#7d6608,#d4ac0d); color:white; }
.res-icon { font-size:52px; flex-shrink:0; }
.res-title { font-family:'Playfair Display',serif; font-size:24px; font-weight:900; margin-bottom:5px; }
.res-sub { font-size:13px; opacity:0.85; margin-bottom:12px; }
.conf-track { background:rgba(255,255,255,0.2); border-radius:20px; height:7px; overflow:hidden; width:240px; max-width:100%; }
.conf-fill { height:100%; background:white; border-radius:20px; transition:width 1.4s cubic-bezier(.17,.67,.3,1.2); width:0%; }

.res-body { background:white; }
.rsec { padding:18px 26px; border-bottom:1px solid var(--border); }
.rsec:last-child { border-bottom:none; }
.rlabel { font-size:11px; text-transform:uppercase; letter-spacing:1.3px; font-weight:700; color:var(--gray); margin-bottom:10px; }
.rtext { font-size:14px; line-height:1.75; color:#374151; }

.tags-row { display:flex; flex-wrap:wrap; gap:8px; }
.tag-red { background:#fef2f2; color:var(--red-dark); border:1px solid #fecaca; padding:5px 13px; border-radius:20px; font-size:13px; font-weight:500; }
.tag-blue { background:#eff6ff; color:#1d4ed8; border:1px solid #bfdbfe; padding:5px 13px; border-radius:20px; font-size:13px; }

.sev-row { display:flex; align-items:center; gap:8px; margin-top:6px; }
.sdot { width:16px; height:16px; border-radius:50%; background:var(--border); }
.sdot.low { background:#27ae60; }
.sdot.mid { background:var(--warn); }
.sdot.hgh { background:var(--red-lite); }
.sev-lbl { font-size:14px; font-weight:700; }

.treat-list { display:flex; flex-direction:column; gap:10px; }
.tstep { display:flex; gap:13px; align-items:flex-start; }
.tnum {
  min-width:30px; height:30px;
  background:var(--green-lt); color:var(--green);
  border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-size:13px; font-weight:800; flex-shrink:0;
}
.ttxt { font-size:14px; line-height:1.65; color:#374151; padding-top:5px; }

.meds-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:14px; }
.med-card {
  background:var(--gray-lt); border-radius:13px;
  padding:16px; border-left:4px solid var(--green);
}
.med-type { font-size:10px; color:var(--green); font-weight:800; text-transform:uppercase; letter-spacing:1px; margin-bottom:6px; }
.med-name { font-size:15px; font-weight:800; color:var(--dark); margin-bottom:5px; }
.med-ai { font-size:11px; color:var(--gray); margin-bottom:8px; font-style:italic; }
.med-dose { font-size:12px; color:#374151; line-height:1.55; margin-bottom:5px; }
.med-freq { font-size:11px; color:var(--green); font-weight:700; margin-bottom:5px; }
.med-warn { font-size:11px; color:#b45309; background:#fef3c7; padding:4px 9px; border-radius:7px; }

.prev-list { display:flex; flex-direction:column; gap:9px; }
.pitem { display:flex; gap:10px; align-items:flex-start; font-size:14px; color:#374151; line-height:1.55; }
.pcheck { color:var(--green); font-size:17px; flex-shrink:0; }

.alert { margin:14px 26px; padding:14px 18px; border-radius:13px; display:flex; gap:13px; align-items:flex-start; }
.alert.danger { background:#fef2f2; border:1px solid #fecaca; }
.alert.info { background:#eff6ff; border:1px solid #bfdbfe; }
.alert-ico { font-size:18px; flex-shrink:0; }
.alert-txt { font-size:13px; color:#374151; line-height:1.55; }

.res-footer { padding:18px 26px; background:var(--gray-lt); display:flex; gap:12px; flex-wrap:wrap; }

/* ===== INFO CARDS ===== */
.info-card {
  margin-top:28px; background:white;
  border-radius:20px; padding:28px;
  box-shadow: var(--shadow);
}
.info-card h2 { font-family:'Playfair Display',serif; font-size:20px; font-weight:700; margin-bottom:20px; }

/* HOW GRID */
.how-card { }
.how-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:0; }
.how-step {
  text-align:center; padding:20px 14px;
  position:relative;
}
.how-step::after {
  content:'→';
  position:absolute; right:-8px; top:50%;
  transform:translateY(-50%);
  color:var(--border); font-size:20px;
}
.how-step:last-child::after { display:none; }
.how-num {
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px;
  background:var(--red-dark); color:white;
  border-radius:50%; font-size:13px; font-weight:800;
  margin-bottom:8px;
}
.how-emoji { font-size:34px; margin-bottom:8px; }
.how-title { font-size:14px; font-weight:700; margin-bottom:5px; }
.how-desc { font-size:12px; color:var(--gray); line-height:1.45; }

/* DISEASE GRID */
.disease-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:10px; }
.dpill {
  background:var(--gray-lt); border-radius:11px;
  padding:12px 15px;
  display:flex; align-items:center; gap:10px;
  font-size:13px; font-weight:500;
}
.ddot { width:11px; height:11px; border-radius:50%; flex-shrink:0; }

/* ===== AUTHOR ===== */
.author-card {
  margin-top:28px;
  background: linear-gradient(135deg, #7b241c, #922b21);
  border-radius:20px;
  box-shadow: 0 6px 28px rgba(122,36,28,0.35);
  overflow:hidden;
  display:flex;
  flex-wrap:wrap;
}
.author-photo-col {
  background:rgba(0,0,0,0.2);
  padding:36px 30px;
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  min-width:190px;
}
.author-img {
  width:130px; height:130px;
  border-radius:50%;
  border:4px solid rgba(255,255,255,0.4);
  object-fit:cover;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.author-img-name {
  color:white; font-size:13px; font-weight:700;
  margin-top:12px; text-align:center; opacity:0.9;
}
.author-info-col { padding:30px 34px; flex:1; color:white; }
.author-role { font-size:11px; text-transform:uppercase; letter-spacing:1.5px; opacity:0.7; margin-bottom:6px; font-weight:700; }
.author-name { font-family:'Playfair Display',serif; font-size:24px; font-weight:900; margin-bottom:20px; }
.author-details { display:flex; flex-direction:column; gap:13px; margin-bottom:20px; }
.adet { display:flex; gap:13px; align-items:flex-start; }
.adet-icon { font-size:18px; flex-shrink:0; }
.adet-label { font-size:10px; text-transform:uppercase; letter-spacing:1px; opacity:0.7; margin-bottom:3px; font-weight:700; }
.adet-val { font-size:14px; font-weight:600; line-height:1.5; }
.diss-box {
  background:rgba(0,0,0,0.2);
  border-radius:13px; padding:16px 20px;
}
.diss-label { font-size:10px; text-transform:uppercase; letter-spacing:1px; opacity:0.75; margin-bottom:7px; font-weight:700; }
.diss-text { font-size:14px; font-weight:600; line-height:1.6; }

/* ===== FOOTER ===== */
footer {
  text-align:center; padding:30px 20px;
  color:var(--gray); font-size:13px;
  border-top:1px solid var(--border);
  margin-top:40px; line-height:1.8;
}

/* ===== UTIL ===== */
.hidden { display:none !important; }

@keyframes fadeUp { from{opacity:0;transform:translateY(20px);} to{opacity:1;transform:translateY(0);} }
@keyframes spin { to{transform:rotate(360deg);} }
@keyframes pulse-glow {
  0%,100%{box-shadow:0 5px 18px rgba(192,57,43,0.32);}
  50%{box-shadow:0 5px 32px rgba(192,57,43,0.58);}
}

@media(max-width:680px){
  main{padding:20px 14px 50px;}
  .upload-body{padding:18px;}
  .author-card{flex-direction:column;}
  .author-photo-col{padding:24px;}
  .author-info-col{padding:20px;}
  .res-header{flex-direction:column;text-align:center;}
  .conf-track{margin:10px auto 0;}
  .meds-grid{grid-template-columns:1fr;}
  .how-step::after{display:none;}
  .rsec{padding:14px 18px;}
}
