/* ============================================
   ApisBot Prozess-Scanner — Mobile-First
   Design System: Gold #F5A623 auf Dark
   ============================================ */

:root {
  --primary: #F5A623;
  --primary-dark: #D4891A;
  --dark: #1a1a1a;
  --deep: #2a2a2a;
  --accent: #00BFFF;
  --text: #cccccc;
  --text-dim: #888888;
  --bg: #0D0D0D;
  --card: #1a1a1a;
  --border: #333333;

  --font-mono: 'Courier New', Courier, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 18px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  padding-bottom: 2rem;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header-logo {
  width: 36px;
  height: 36px;
}

.header h1 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 1px;
}

/* ── Project Selector ── */
.project-section {
  background: #111;
}

.project-selector {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.project-selector select {
  flex: 1;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.project-selector select:focus {
  border-color: var(--primary);
}

.btn-icon-only {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid var(--primary);
  background: transparent;
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon-only:active {
  background: var(--primary);
  color: var(--bg);
}

.btn-icon-delete {
  border-color: #cc3333;
  color: #cc3333;
  font-size: 1.2rem;
}

.btn-icon-delete:active {
  background: #cc3333;
  color: #fff;
}

.project-info {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.project-tag {
  background: var(--primary);
  color: var(--bg);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.project-detail {
  color: var(--text-dim);
  font-size: 0.8rem;
}

/* ── New Project Form ── */
.form-buttons {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.form-buttons .btn {
  flex: 1;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.5rem;
  font-family: var(--font-body);
}

.btn-text:active {
  color: var(--text);
}

/* ── Sections ── */
.section {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section h2 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

/* ── Inputs ── */
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
  margin-top: 1rem;
}

label:first-child {
  margin-top: 0;
}

input[type="text"] {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus {
  border-color: var(--primary);
}

input[type="text"]::placeholder {
  color: var(--text-dim);
}

textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.2s;
}

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

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

/* ── Buttons ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1.1rem;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-icon {
  font-size: 1.3rem;
}

/* Record Button */
.btn-record {
  background: var(--deep);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-record:active,
.btn-record.active {
  background: #3a1010;
  border-color: #cc3333;
  color: #ff4444;
}

/* Photo Buttons */
.photo-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex: 1;
  padding: 1.1rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: 12px;
  cursor: pointer;
  background: var(--deep);
  color: var(--accent);
  border: 2px solid var(--accent);
  text-align: center;
  margin-top: 0;
  transition: all 0.2s;
}

.btn-photo:active {
  background: #0a2a3a;
}

.btn-gallery {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-gallery:active {
  background: #2a1a00;
}

/* Send Button */
.btn-send {
  background: var(--primary);
  color: var(--bg);
  border: none;
  font-size: 1.2rem;
}

.btn-send:disabled {
  background: var(--deep);
  color: var(--text-dim);
  border: 1px solid var(--border);
  cursor: not-allowed;
}

.btn-send:not(:disabled):active {
  background: var(--primary-dark);
}

/* ── Recording Indicator ── */
.recording-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #ff4444;
  font-weight: 600;
}

.pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4444;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Transcript ── */
.transcript-container {
  margin-top: 1rem;
}

.transcript-container label {
  margin-top: 0;
}

/* ── Photos ── */
.photo-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #ff4444;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Status ── */
.status {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.status.sending {
  background: #1a2a3a;
  color: var(--accent);
}

.status.success {
  background: #1a3a1a;
  color: #44cc44;
}

.status.error {
  background: #3a1a1a;
  color: #ff4444;
}

/* ── Connection Badge ── */
.badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  margin-left: auto;
}

.badge-online {
  background: #1a3a1a;
  color: #44cc44;
}

.badge-offline {
  background: #3a1a1a;
  color: #ff4444;
}

/* ── Queue Bar ── */
.queue-section {
  border-bottom: 1px solid var(--primary);
  background: #1a1800;
}

.queue-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#queue-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
}

.btn-inline {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-inline:active {
  background: var(--primary);
  color: var(--bg);
}

/* ── History ── */
.history-item {
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.history-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.history-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.history-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.history-badge.pending {
  background: #3a3a1a;
  color: var(--primary);
}

.history-badge.synced {
  background: #1a3a1a;
  color: #44cc44;
}

.history-firma {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.history-preview {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.history-photos {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 0.3rem;
}

.history-delete {
  font-size: 0.7rem;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0;
  margin-top: 0.3rem;
  text-decoration: underline;
}

.history-delete:active {
  color: #ff4444;
}

/* ── Tab Navigation ── */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

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

.tab-btn:active {
  background: var(--deep);
}

.tab-content {
  display: none;
}

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

/* ── Notizen ── */
.notiz-kategorie-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
}

.notiz-filter {
  margin-bottom: 1rem;
}

.notiz-filter select {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-family: var(--font-body);
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

#notiz-kategorie {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

#notiz-kategorie:focus {
  border-color: var(--primary);
}

/* ── Utilities ── */
.hidden {
  display: none !important;
}

.hidden-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* ── Safe Areas (iPhone Notch) ── */
@supports (padding: env(safe-area-inset-top)) {
  .header {
    padding-top: calc(1.25rem + env(safe-area-inset-top));
  }
  body {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
}
