@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --green: #00E676;
  --green-dark: #00C853;
  --green-forest: #1B5E20;
  --green-bg: rgba(0,230,118,0.08);
  --bg: #0A0A0A;
  --surface: #141414;
  --card: #1a1a1a;
  --border: #2a2a2a;
  --text: #FFFFFF;
  --text2: rgba(255,255,255,0.55);
  --text3: rgba(255,255,255,0.3);
  --danger: #ef5350;
  --warning: #FFA726;
  --success: #66BB6A;
  --info: #42A5F5;
  --radius: 12px;
  --font: 'Inter', -apple-system, sans-serif;
  --max-width: 480px;
}

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

html, body {
  height:100%; font-family:var(--font); background:var(--bg); color:var(--text);
  font-size:16px; -webkit-font-smoothing:antialiased; overflow-x:hidden;
}

#app { max-width:var(--max-width); margin:0 auto; min-height:100vh; position:relative; }

/* Screens */
.screen { display:none; min-height:100vh; flex-direction:column; }
.screen.active { display:flex; }

/* Logo */
.logo-thin { font-weight:300; color:rgba(255,255,255,0.85); }
.logo-bold { font-weight:900; color:var(--green); }

/* Buttons */
.btn {
  padding:14px 24px; border:none; border-radius:var(--radius); font-family:var(--font);
  font-weight:600; font-size:15px; cursor:pointer; display:inline-flex; align-items:center;
  justify-content:center; gap:8px; transition:transform 0.15s; -webkit-tap-highlight-color:transparent;
}
.btn:active { transform:scale(0.97); }
.btn-primary { background:var(--green); color:#0A0A0A; }
.btn-secondary { background:var(--surface); color:var(--text); border:1px solid var(--border); }
.btn-danger { background:var(--danger); color:white; }
.btn-ghost { background:transparent; color:var(--text2); }
.btn-block { width:100%; }
.btn-sm { padding:8px 16px; font-size:13px; }
.btn-lg { padding:16px 32px; font-size:17px; }

/* Input */
.input {
  width:100%; padding:14px 16px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); color:var(--text); font-size:16px; font-family:var(--font); outline:none;
}
.input:focus { border-color:var(--green); }
.input::placeholder { color:var(--text3); }
.input-label { display:block; font-size:13px; color:var(--text2); margin-bottom:6px; font-weight:500; }
.input-group { margin-bottom:16px; }

/* PIN */
.pin-container { display:flex; gap:12px; justify-content:center; margin:16px 0; }
.pin-digit {
  width:56px; height:64px; text-align:center; font-size:28px; font-weight:700;
  background:var(--surface); border:2px solid var(--border); border-radius:var(--radius);
  color:var(--text); outline:none;
}
.pin-digit:focus { border-color:var(--green); }

/* Cards */
.card { background:var(--card); border-radius:16px; padding:16px; border:1px solid var(--border); }

/* Auth */
.auth-screen { flex:1; display:flex; flex-direction:column; justify-content:center; padding:32px 24px; gap:32px; }
.auth-header { text-align:center; }
.auth-footer { text-align:center; font-size:14px; color:var(--text2); }
.auth-footer a { color:var(--green); text-decoration:none; font-weight:600; }

/* Chat bubbles */
.msg { max-width:85%; padding:10px 14px; border-radius:16px; font-size:14px; line-height:1.5; word-wrap:break-word; }
.msg-in { background:var(--card); border-bottom-left-radius:4px; align-self:flex-start; }
.msg-out { background:var(--green-forest); color:white; border-bottom-right-radius:4px; align-self:flex-end; }
.msg-label { font-size:11px; font-weight:600; color:var(--green); margin-bottom:4px; }
.msg-time { font-size:10px; color:var(--text3); margin-top:4px; text-align:right; }

/* Typing */
.typing { display:flex; gap:4px; padding:8px 16px; }
.typing-dot { width:8px; height:8px; background:var(--text3); border-radius:50%; animation:bounce 1.2s infinite; }
.typing-dot:nth-child(2) { animation-delay:0.2s; }
.typing-dot:nth-child(3) { animation-delay:0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

/* Chat input */
.chat-textarea {
  flex:1; padding:10px 14px; background:var(--card); border:1px solid var(--border);
  border-radius:24px; color:var(--text); font-size:15px; font-family:var(--font);
  outline:none; resize:none; max-height:120px; min-height:42px; line-height:1.4;
}
.chat-textarea::placeholder { color:var(--text3); }
.chat-send-btn {
  width:44px; height:44px; border-radius:50%; background:var(--green); border:none;
  cursor:pointer; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.icon-btn {
  width:36px; height:36px; border-radius:50%; background:transparent; border:none;
  cursor:pointer; color:var(--text2); font-size:20px; display:flex; align-items:center; justify-content:center;
}

/* Tab bar */
.tab-bar {
  position:fixed; bottom:0; left:50%; transform:translateX(-50%); width:100%;
  max-width:var(--max-width); background:var(--surface); border-top:1px solid var(--border);
  display:flex; padding:6px 0; z-index:100;
}
.tab {
  flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 0;
  cursor:pointer; background:none; border:none; font-family:var(--font);
  -webkit-tap-highlight-color:transparent;
}
.tab-icon { font-size:22px; }
.tab-label { font-size:10px; color:var(--text3); font-weight:500; }
.tab.active .tab-label { color:var(--green); font-weight:600; }

/* Farm cards */
.farm-card {
  background:var(--card); border-radius:16px; padding:16px; margin:0 20px 12px;
  display:flex; align-items:center; gap:14px; cursor:pointer; border:1px solid var(--border);
}
.farm-card:active { border-color:var(--green); }

/* Spinner */
.spinner { width:32px; height:32px; border:3px solid var(--border); border-top-color:var(--green); border-radius:50%; animation:spin 0.8s linear infinite; margin:20px auto; }
@keyframes spin { to { transform:rotate(360deg); } }

/* Toast */
.toast {
  position:fixed; bottom:80px; left:50%; transform:translateX(-50%); background:var(--card);
  border:1px solid var(--border); padding:12px 20px; border-radius:var(--radius);
  font-size:14px; z-index:1000; animation:toastIn 0.3s ease; max-width:90%;
}
@keyframes toastIn { from{opacity:0;transform:translate(-50%,16px)} to{opacity:1;transform:translate(-50%,0)} }

/* Bottom sheet overlay */
.overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.8); z-index:200;
  display:flex; align-items:flex-end; justify-content:center;
}
.bottom-sheet {
  background:var(--card); border-radius:20px 20px 0 0; padding:20px; max-width:480px;
  width:100%; max-height:90vh; overflow-y:auto;
}
.sheet-handle { width:40px; height:4px; background:var(--border); border-radius:4px; margin:0 auto 12px; }

/* Utilities */
.text-center { text-align:center; }
.text-muted { color:var(--text2); }
.text-sm { font-size:13px; }
.text-xs { font-size:11px; }
.mt-8 { margin-top:8px; }
.mt-16 { margin-top:16px; }
.mb-8 { margin-bottom:8px; }
.mb-16 { margin-bottom:16px; }
.p-20 { padding:20px; }

/* Chat and Setup2 screens */#screen-chat > *,
#screen-setup2 > * {
  flex-shrink: 0;
}
#chatMsgs, #setup2Msgs {
  flex: 1 1 0 !important;
  overflow-y: auto !important;
  min-height: 0 !important;
  -webkit-overflow-scrolling: touch;
}
