/* Theia - Agenten-Plattform */
/* Dark Theme - Material Design Inspired */

:root {
  --bg: #0a0f1a;
  --bg-card: #1a2332;
  --bg-card-hover: #1f2b3d;
  --bg-sidebar: #0d1520;
  --bg-input: #0f1923;
  --border: #2a3a4e;
  --text: #e8eaed;
  --text-dim: #8a9ab5;
  --text-muted: #5a6a7e;
  --accent: #a78bfa;
  --accent-hover: #8b6ff0;
  --accent-glow: rgba(167, 139, 250, 0.15);
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --blue: #60a5fa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: all 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================ */
/* LOGIN SCREEN                                  */
/* ============================================ */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0f1a 0%, #1a1a2e 50%, #0a0f1a 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.subtitle {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}

.input-icon {
  position: relative;
}

.input-icon .mdi {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
}

.input-icon input {
  width: 100%;
  padding: 10px 12px 10px 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: var(--transition);
}

.input-icon input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--text-dim);
}

.checkbox-group input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn:active {
  transform: translateY(0);
}

.login-toggle {
  margin-top: 16px;
  font-size: 13px;
}

.login-toggle a {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}

.login-toggle a:hover {
  text-decoration: underline;
}

#login-alert, #register-alert {
  margin-bottom: 16px;
}

.alert-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.alert-success {
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ============================================ */
/* APP LAYOUT                                    */
/* ============================================ */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
#sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .mdi {
  font-size: 24px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(167, 139, 250, 0.05);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-glow);
  border-left-color: var(--accent);
}

.nav-item .mdi {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  color: var(--text-dim);
}

.user-avatar {
  font-size: 20px;
}

.user-name {
  font-weight: 500;
  color: var(--text);
}

/* Main Content */
#content {
  flex: 1;
  margin-left: 240px;
  padding: 24px 32px;
  min-height: 100vh;
}

/* ============================================ */
/* PAGES                                         */
/* ============================================ */

.page {
  display: none;
  animation: fadeIn 0.2s ease;
}

.page.active {
  display: block;
}

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

.page-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header h2 .mdi {
  color: var(--accent);
}

.header-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================ */
/* CARDS                                         */
/* ============================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
}

.status-card {
  display: flex;
  gap: 16px;
  align-items: center;
}

.card-icon {
  font-size: 32px;
  color: var(--accent);
  flex-shrink: 0;
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-value {
  font-size: 24px;
  font-weight: 700;
}

.wide-card {
  margin-bottom: 24px;
}

.card-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header .mdi {
  color: var(--accent);
}

/* ============================================ */
/* PROGRESS BARS                                 */
/* ============================================ */

.progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.5s ease;
  min-width: 0;
}

.progress-fill.warning { background: var(--warning); }
.progress-fill.error { background: var(--error); }
.progress-fill.success { background: var(--success); }

/* ============================================ */
/* STATUS                                        */
/* ============================================ */

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}

/* ============================================ */
/* INFO GRID                                     */
/* ============================================ */

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

/* ============================================ */
/* ACTIVITY LOG                                  */
/* ============================================ */

.activity-list {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(42, 58, 78, 0.5);
  font-size: 13px;
  color: var(--text-dim);
}

.activity-time {
  color: var(--text-muted);
  font-size: 11px;
  margin-right: 12px;
}

/* ============================================ */
/* AGENTS                                        */
/* ============================================ */

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.agent-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: var(--transition);
}

.agent-card:hover {
  border-color: var(--accent);
}

.agent-card.placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.agent-card.placeholder .mdi {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  color: var(--text-muted);
}

/* ============================================ */
/* SETTINGS                                      */
/* ============================================ */

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(42, 58, 78, 0.5);
}

.settings-label {
  color: var(--text-muted);
  font-size: 13px;
}

.settings-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.settings-form {
  max-width: 400px;
}

/* ============================================ */
/* COMING SOON                                   */
/* ============================================ */

.coming-soon {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.coming-soon .mdi {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.coming-soon p {
  font-size: 16px;
  margin-bottom: 8px;
}

.coming-soon small {
  font-size: 12px;
  color: var(--text-muted);
}

.metrics-placeholder {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================ */
/* UTILITIES                                     */
/* ============================================ */

.hidden {
  display: none !important;
}

/* ============================================ */
/* MOBILE                                        */
/* ============================================ */

@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    left: -240px;
    transition: left 0.3s ease;
    z-index: 200;
  }

  #sidebar.open {
    left: 0;
  }

  #content {
    margin-left: 0;
    padding: 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    margin: 16px;
    padding: 24px;
  }
}
