
:root {
  --bg: #000000;
  --bg-secondary: rgba(15, 15, 25, 0.9);
  --bg-hover: rgba(99, 102, 241, 0.08);
  --border: rgba(99, 102, 241, 0.15);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-hover: #8b5cf6;
  --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  --danger: #ef4444;
  --success: #22c55e;
  --unread: #ffffff;
  --radius: 8px;
  --glow: 0 0 20px rgba(99, 102, 241, 0.3);
  --glow-strong: 0 0 30px rgba(99, 102, 241, 0.4);
}

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

body {
  font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

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

.sidebar {
  width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(10px);
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.btn-compose {
  display: block;
  background: var(--primary-gradient);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
  margin-bottom: 24px;
  transition: all 0.3s;
  box-shadow: var(--glow);
}
.btn-compose:hover { box-shadow: var(--glow-strong); color: white; transform: translateY(-1px); }

.nav-list {
  list-style: none;
  flex: 1;
}
.nav-list a, .nav-link {
  display: block;
  padding: 8px 12px;
  color: var(--text-muted);
  border-radius: var(--radius);
  margin-bottom: 4px;
  transition: all 0.15s;
}
.nav-list a:hover, .nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-list a.active, .nav-link.active { background: var(--bg-hover); color: var(--text); font-weight: 600; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 0.85rem;
}
.user-email {
  display: block;
  color: var(--text-muted);
  margin-bottom: 8px;
  word-break: break-all;
}

.content {
  flex: 1;
  padding: 32px;
  max-width: 900px;
  overflow-y: auto;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff, #e2e8f0, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
h3 { font-size: 1.1rem; margin-bottom: 12px; }

.email-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.email-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  transition: background 0.15s;
  gap: 12px;
}
.email-row:last-child { border-bottom: none; }
.email-row:hover { background: var(--bg-hover); }
.email-row.unread { color: var(--unread); font-weight: 600; }

.email-star { flex-shrink: 0; font-size: 1.1rem; }
.email-star.starred { color: #a855f7; }
.email-from { width: 200px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-subject { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.email-date { flex-shrink: 0; font-size: 0.85rem; color: var(--text-muted); }

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.back-link { color: var(--text-muted); }
.message-actions { display: flex; gap: 8px; }

.message-meta {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-muted);
}

.message-body { margin-top: 20px; }
.email-body-frame {
  width: 100%;
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
}
.email-body-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.6;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
}
.form-group textarea {
  resize: vertical;
  min-height: 200px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--glow);
}
.btn-primary:hover { box-shadow: var(--glow-strong); transform: translateY(-1px); }

.btn-secondary {
  display: inline-block;
  padding: 10px 24px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  margin-left: 8px;
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }

.btn-small {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-small:hover { background: var(--bg-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: rgba(231, 76, 60, 0.1); }

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: inherit;
  padding: 8px 12px;
  border-radius: var(--radius);
  display: block;
  width: 100%;
  text-align: left;
}
.btn-link:hover { background: var(--bg-hover); color: var(--text); }

.inline { display: inline; }

.form-actions {
  display: flex;
  align-items: center;
  margin-top: 8px;
}

.error {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.success {
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.settings-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.settings-form { max-width: 400px; }

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  backdrop-filter: blur(10px);
  box-shadow: var(--glow);
}
.login-logo {
  font-size: 1.8rem;
  text-align: center;
  margin-bottom: 4px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}
.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    gap: 8px;
  }
  .logo { margin-bottom: 0; }
  .btn-compose { margin-bottom: 0; padding: 8px 14px; }
  .nav-list { display: flex; gap: 4px; }
  .sidebar-footer { border-top: none; padding-top: 0; display: flex; gap: 12px; align-items: center; }
  .content { padding: 16px; }
  .email-from { width: 120px; }
}
