:root {
  --background: #ffffff;
  --foreground: #020817;
  --card: #ffffff;
  --card-foreground: #020817;
  --popover: #ffffff;
  --popover-foreground: #020817;
  --primary: #0f172a;
  --primary-foreground: #f8fafc;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #f8fafc;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #94a3b8;
  --radius: 0.5rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body, html { height: 100%; width: 100%; background: var(--secondary); color: var(--foreground); font-size: 16px; }

/* --- Components --- */
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius); font-weight: 500; font-size: 0.875rem;
    height: 2.5rem; padding: 0 1rem; cursor: pointer; border: none; transition: background 0.2s;
}
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); border: 1px solid var(--border); }
.btn-destructive { background: var(--destructive); color: var(--destructive-foreground); }

.input {
    width: 100%; height: 2.5rem; padding: 0 0.75rem; border: 1px solid var(--input);
    border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 1rem; outline: none;
}
.input:focus { border-color: var(--ring); }

.label { font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; display: block; }

/* --- Screens --- */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--background); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}

.login-card { width: 100%; max-width: 400px; text-align: center; }
.login-card h2 { margin-bottom: 0.5rem; font-weight: 700; font-size: 1.5rem; }
.login-card p { color: var(--muted-foreground); font-size: 0.875rem; margin-bottom: 1.5rem; }

/* --- Main App Layout --- */
#main-content { display: flex; flex-direction: column; height: 100%; }
#map { flex: 1; z-index: 1; border-bottom: 1px solid var(--border); }

#chat-container {
    height: 350px; max-height: 45vh; background: var(--background);
    display: flex; flex-direction: column; z-index: 10;
    margin: 1rem; 
    border: 1px solid #475569; 
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

#chat-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }

.msg { padding: 0.5rem 0.75rem; border-radius: var(--radius); font-size: 0.875rem; background: var(--secondary); max-width: 85%; align-self: flex-start; }
.msg-user { font-weight: 600; color: var(--primary); margin-bottom: 2px; }
.msg-text { word-break: break-word; }
.msg-time { font-size: 0.7rem; color: var(--muted-foreground); margin-top: 2px; display: block; text-align: right; }

.chat-input { display: flex; gap: 0.5rem; padding: 1rem; border-top: 1px solid var(--border); }
.chat-input input { margin-bottom: 0; }

.status-bar {
    padding: 0.75rem 1rem; background: var(--card); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); z-index: 100;
}

.header-tile {
    display: flex; align-items: center; gap: 1rem;
}

.header-logo { height: 40px; width: auto; object-fit: contain; }

.status-info { display: flex; flex-direction: column; gap: 2px; }

#status-text { font-size: 0.85rem; font-weight: 700; letter-spacing: -0.01em; }
#time-left { font-size: 0.75rem; color: var(--muted-foreground); font-weight: 500; }

/* --- Admin / Set Page --- */
.admin-container { padding: 2rem 1rem; max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem; }
.admin-header { text-align: center; margin-bottom: 1rem; }
.admin-header h1 { font-weight: 700; letter-spacing: -0.02em; font-size: 2rem; }

.setup-map { height: 250px; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--border); }

.hidden { display: none !important; }
.error { color: var(--destructive); font-size: 0.75rem; margin-top: -0.5rem; margin-bottom: 1rem; text-align: left; }
