/* =============================================
   Plant Health Doctor - Mobile First
   ============================================= */

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

.phd-body {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* ---- Input Methods ---- */
.input-methods { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }

.method-btn {
    padding: 18px 15px;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.method-btn span   { font-size:30px; }
.method-btn strong { display:block; color:#1e293b; font-size:15px; }
.method-btn small  { color:#64748b; font-size:12px; }
.method-btn:hover  { border-color:#ef4444; background:#fff1f2; }
.method-btn.active {
    border-color: #ef4444;
    background: linear-gradient(135deg,#fee2e2 0%,#fecaca 100%);
}

/* ---- Tips Bar ---- */
.photo-tips-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: linear-gradient(135deg,#fef3c7 0%,#fde68a 100%);
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 13px;
    color: #92400e;
    font-weight: 600;
}

.tip-chip {
    background: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: #92400e;
    border: 1.5px solid #fbbf24;
}

/* ---- Camera ---- */
.camera-view {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 0 auto 16px;
    background: #0f172a;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4/3;
}

#plantCamera { width:100%; height:100%; object-fit:cover; display:block; }

.camera-guide { position:absolute; inset:0; pointer-events:none; }
.guide-corner { position:absolute; width:30px; height:30px; border-color:rgba(255,255,255,0.8); border-style:solid; }
.guide-corner.tl { top:20px; left:20px;    border-width:3px 0 0 3px; border-radius:4px 0 0 0; }
.guide-corner.tr { top:20px; right:20px;   border-width:3px 3px 0 0; border-radius:0 4px 0 0; }
.guide-corner.bl { bottom:20px; left:20px; border-width:0 0 3px 3px; border-radius:0 0 0 4px; }
.guide-corner.br { bottom:20px; right:20px;border-width:0 3px 3px 0; border-radius:0 0 4px 0; }

.camera-btns { display:flex; justify-content:center; gap:12px; flex-wrap:wrap; }

.cam-btn {
    padding: 11px 22px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.3s;
}
.cam-btn:hover { background:#f1f5f9; border-color:#ef4444; }
.cam-btn.primary {
    background: linear-gradient(135deg,#ef4444 0%,#dc2626 100%);
    color: white;
    border-color: #ef4444;
}
.cam-btn.primary:hover { transform:translateY(-2px); box-shadow:0 8px 20px rgba(239,68,68,0.35); }

/* ---- Upload ---- */
.upload-zone {
    border: 3px dashed #fca5a5;
    border-radius: 16px;
    padding: 50px 20px;
    text-align: center;
    background: linear-gradient(135deg,#fff1f2 0%,#fee2e2 100%);
    cursor: pointer;
    transition: all 0.3s;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: #ef4444;
    background: linear-gradient(135deg,#fee2e2 0%,#fecaca 100%);
    transform: scale(1.01);
}
.upload-icon { font-size:60px; margin-bottom:15px; }
.upload-zone h3 { color:#991b1b; font-size:20px; margin-bottom:8px; }
.upload-zone p  { color:#b91c1c; margin-bottom:6px; font-size:14px; }
.hint           { font-size:12px !important; color:#f87171 !important; margin-bottom:20px !important; }

.upload-btn {
    padding: 11px 28px;
    background: linear-gradient(135deg,#ef4444 0%,#dc2626 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}
.upload-btn:hover { transform:translateY(-2px); box-shadow:0 8px 20px rgba(239,68,68,0.3); }

/* ---- Results ---- */
.results-wrap {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 20px;
    animation: fadeUp 0.4s;
}

@keyframes fadeUp {
    from { opacity:0; transform:translateY(16px); }
    to   { opacity:1; transform:translateY(0); }
}

.preview-box { text-align:center; }
.preview-box img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 14px;
    border: 3px solid #fecaca;
    background: #fff1f2;
}

.retry-btn {
    margin-top: 12px;
    padding: 9px 20px;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}
.retry-btn:hover { background:#fee2e2; border-color:#ef4444; color:#dc2626; }

/* ---- Diagnosis Box ---- */
.diagnosis-box {
    background: linear-gradient(135deg,#fff1f2 0%,#fee2e2 100%);
    border-radius: 16px;
    padding: 22px;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Loading ---- */
.loading-state { text-align:center; width:100%; position:relative; }

.pulse-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid #ef4444;
    margin: 0 auto 10px;
    animation: pulse-anim 1.5s ease-in-out infinite;
    position: relative;
}

@keyframes pulse-anim {
    0%   { transform:scale(0.9); box-shadow:0 0 0 0 rgba(239,68,68,0.4); }
    70%  { transform:scale(1);   box-shadow:0 0 0 20px rgba(239,68,68,0); }
    100% { transform:scale(0.9); box-shadow:0 0 0 0 rgba(239,68,68,0); }
}

.stethoscope {
    font-size: 36px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -90%);
}

.loading-state p     { color:#991b1b; font-size:17px; font-weight:700; margin-bottom:6px; margin-top:10px; }
.loading-state small { color:#b91c1c; font-size:13px; }

/* ---- Diagnosis Result ---- */
#diagnosisResult { width:100%; animation:fadeUp 0.5s; }

/* Health Score Banner */
.health-banner {
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.health-banner.healthy  { background:linear-gradient(135deg,#dcfce7,#bbf7d0); }
.health-banner.warning  { background:linear-gradient(135deg,#fef3c7,#fde68a); }
.health-banner.critical { background:linear-gradient(135deg,#fee2e2,#fecaca); }

.health-emoji  { font-size:44px; display:block; margin-bottom:8px; }
.health-title  { font-size:20px; font-weight:800; margin-bottom:4px; }
.health-banner.healthy  .health-title { color:#166534; }
.health-banner.warning  .health-title { color:#92400e; }
.health-banner.critical .health-title { color:#991b1b; }

.health-score {
    display: inline-block;
    padding: 4px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-top: 6px;
}
.health-banner.healthy  .health-score { background:#10b981; color:white; }
.health-banner.warning  .health-score { background:#f59e0b; color:white; }
.health-banner.critical .health-score { background:#ef4444; color:white; }

/* Disease Cards */
.disease-cards { display:flex; flex-direction:column; gap:12px; margin-bottom:16px; }

.disease-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    border-left: 5px solid;
}
.disease-card.high   { border-color:#ef4444; }
.disease-card.medium { border-color:#f59e0b; }
.disease-card.low    { border-color:#10b981; }

.disease-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }

.disease-name { font-weight:800; color:#1e293b; font-size:15px; }

.severity-badge {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.severity-badge.high   { background:#fee2e2; color:#dc2626; }
.severity-badge.medium { background:#fef3c7; color:#d97706; }
.severity-badge.low    { background:#dcfce7; color:#16a34a; }

.prob-bar-wrap { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.prob-bar { flex:1; height:8px; background:#f1f5f9; border-radius:4px; overflow:hidden; }
.prob-fill { height:100%; border-radius:4px; transition:width 1s ease; }
.disease-card.high   .prob-fill { background:linear-gradient(90deg,#ef4444,#dc2626); }
.disease-card.medium .prob-fill { background:linear-gradient(90deg,#f59e0b,#d97706); }
.disease-card.low    .prob-fill { background:linear-gradient(90deg,#10b981,#059669); }
.prob-pct { font-size:12px; font-weight:800; color:#64748b; min-width:32px; text-align:right; }

.disease-desc { font-size:13px; color:#475569; line-height:1.6; }

/* Care Guide */
.care-guide {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 14px;
}

.care-guide h5 { color:#1e293b; font-size:15px; margin-bottom:14px; }

.care-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f8fafc;
}
.care-item:last-child { border:none; }

.care-icon { font-size:22px; flex-shrink:0; margin-top:2px; }

.care-content strong { display:block; color:#1e293b; font-size:13px; margin-bottom:3px; }
.care-content p      { color:#64748b; font-size:12px; margin:0; line-height:1.5; }

/* Water indicator */
.water-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-weight: 700;
    font-size: 15px;
}
.water-indicator.give-water {
    background: linear-gradient(135deg,#e0f2fe,#bae6fd);
    color: #0c4a6e;
    border-left: 5px solid #0ea5e9;
}
.water-indicator.stop-water {
    background: linear-gradient(135deg,#fef3c7,#fde68a);
    color: #78350f;
    border-left: 5px solid #f59e0b;
}
.water-indicator.normal-water {
    background: linear-gradient(135deg,#dcfce7,#bbf7d0);
    color: #166534;
    border-left: 5px solid #10b981;
}
.water-indicator span:first-child { font-size:26px; }

/* Treatment Steps */
.treatment-steps {
    background: white;
    border-radius: 12px;
    padding: 16px;
}
.treatment-steps h5 { color:#1e293b; font-size:15px; margin-bottom:14px; }

.step-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}
.step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg,#ef4444,#dc2626);
    color: white;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.step-text { font-size:13px; color:#334155; line-height:1.6; padding-top:3px; }

/* ---- Error ---- */
#diagnosisError { width:100%; text-align:center; padding:20px; animation:fadeUp 0.5s; }
.err-emoji { font-size:52px; display:block; margin-bottom:12px; }
.err-title { color:#dc2626; font-size:20px; font-weight:800; margin-bottom:10px; }
.err-msg   { background:#fee2e2; border:2px solid #fca5a5; border-radius:10px; padding:12px; color:#7f1d1d; font-size:14px; margin-bottom:12px; }
.err-tip   { background:#fef3c7; border:2px solid #fde68a; border-radius:10px; padding:12px; color:#78350f; font-size:13px; }

/* ---- Info Grid ---- */
.info-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:18px; }

.info-card { padding:22px; border-radius:14px; }
.info-card.green  { background:linear-gradient(135deg,#f0fdf4,#dcfce7); }
.info-card.blue   { background:linear-gradient(135deg,#f0f9ff,#e0f2fe); }
.info-card.yellow { background:linear-gradient(135deg,#fffbeb,#fef3c7); }

.info-card h4 { font-size:16px; margin-bottom:14px; }
.info-card.green  h4 { color:#166534; }
.info-card.blue   h4 { color:#0c4a6e; }
.info-card.yellow h4 { color:#92400e; }

.info-card ul { padding-left:18px; line-height:2; font-size:13px; }
.info-card.green  li { color:#15803d; }
.info-card.blue   li { color:#0369a1; }
.info-card.yellow li { color:#78350f; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .phd-body { padding:20px 15px; gap:20px; }
    .results-wrap { grid-template-columns:1fr; }
    .diagnosis-box { min-height:200px; }
    .camera-view { aspect-ratio:3/4; }
    .cam-btn { flex:1; min-width:110px; justify-content:center; }
    .info-grid { grid-template-columns:1fr; }
}

@media (max-width: 480px) {
    .phd-container { padding:10px 5px; }
    .phd-body { padding:15px 10px; }
    .upload-zone { padding:35px 15px; }
    .upload-icon { font-size:48px; }
    .photo-tips-bar { font-size:12px; }
}