/* =====================================================================
   Flower AI Outlook Add-in – Styles
   Branding: Gold #C4974A, Dunkel #1a1a2e
   ===================================================================== */

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

:root {
  --gold: #C4974A;
  --gold-light: #d4a85a;
  --gold-dim: rgba(196, 151, 74, 0.15);
  --gold-border: rgba(196, 151, 74, 0.3);
  --bg-deep: #12122a;
  --bg-main: #1a1a2e;
  --bg-card: #222240;
  --bg-input: #2a2a4a;
  --bg-hover: #30305a;
  --text-primary: #e0e0f0;
  --text-secondary: #9a9ab0;
  --text-muted: #6a6a8a;
  --border: #2a2a4a;
  --success: #4caf7d;
  --error: #ef5350;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
}

/* =====================================================================
   AUTH SCREEN
   ===================================================================== */
#auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
  text-align: center;
  gap: 16px;
}

.auth-logo {
  font-size: 48px;
  margin-bottom: 4px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: -0.3px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  max-width: 260px;
}

/* =====================================================================
   APP SCREEN
   ===================================================================== */
#app-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--gold-border);
  flex-shrink: 0;
}

.header-brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  flex: 1;
}

.header-user {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* E-Mail-Info */
.email-info {
  padding: 7px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.email-subject {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-from {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--gold-border);
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 9px 4px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font);
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
  color: var(--gold-light);
}

.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Tab-Inhalt */
.tab-content {
  display: none;
  flex-direction: column;
  padding: 12px;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}

.tab-content.active {
  display: flex;
}

/* =====================================================================
   BUTTONS
   ===================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--gold);
  color: #12122a;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font);
  transition: background 0.15s, transform 0.1s;
  width: 100%;
}

.btn-primary:hover {
  background: var(--gold-light);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--bg-input);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  padding: 7px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  transition: background 0.15s;
  flex: 1;
}

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

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.15s;
}

.btn-icon:hover {
  color: var(--text-primary);
}

/* =====================================================================
   FORM-ELEMENTE
   ===================================================================== */
.form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.form-label {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: var(--font);
  flex: 1;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

select:focus {
  border-color: var(--gold);
}

textarea {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: var(--font);
  resize: none;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

textarea::placeholder {
  color: var(--text-muted);
}

textarea:focus {
  border-color: var(--gold);
}

/* =====================================================================
   ERGEBNIS-BOX
   ===================================================================== */
.result-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: 200px;
  min-height: 60px;
  display: none;
}

.result-box.visible {
  display: block;
}

.actions-row {
  display: flex;
  gap: 8px;
}

/* =====================================================================
   CHAT
   ===================================================================== */
.chat-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  max-height: 300px;
  padding-right: 2px;
}

.chat-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
}

.chat-bubble {
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.55;
  max-width: 92%;
  word-wrap: break-word;
}

.chat-bubble.user {
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  align-self: flex-end;
  color: #e8d8b8;
}

.chat-bubble.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  align-self: flex-start;
  color: var(--text-primary);
}

.chat-input-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.chat-input-row textarea {
  flex: 1;
}

.chat-input-row .btn-primary {
  width: auto;
  padding: 9px 12px;
  flex-shrink: 0;
}

/* =====================================================================
   LADEINDIKATOR (Footer)
   ===================================================================== */
#loading-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-deep);
  border-top: 1px solid var(--gold-border);
  padding: 8px 14px;
  display: none;
  align-items: center;
  gap: 10px;
  color: var(--gold);
  font-size: 12px;
  z-index: 100;
}

#loading-bar.visible {
  display: flex;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--gold-border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =====================================================================
   TOAST-BENACHRICHTIGUNG
   ===================================================================== */
#toast {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: var(--bg-deep);
  border: 1px solid var(--gold-border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  z-index: 200;
  transition: transform 0.25s ease;
  white-space: nowrap;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
}

#toast.error {
  border-color: var(--error);
  color: var(--error);
}

/* =====================================================================
   SCROLLBAR
   ===================================================================== */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
