/* === CARE APP - MOBILE FIRST DESIGN === */
:root {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #222633;
  --text: #e8eaf0;
  --text-muted: #8a8fa8;
  --primary: #6c5ce7;
  --primary-hover: #7d6ff0;
  --accent: #00cec9;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #e17055;
  --critical: #d63031;
  --phone: #0984e3;
  --border: #2d3142;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font: 'Inter', -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* === TOPBAR === */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-left .logo {
  font-size: 26px;
}

.topbar-left h1 {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  text-decoration: none;
  transition: color 0.2s;
}

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

/* === TAB NAVIGATION === */
.tab-nav {
  display: flex;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 55px;
  z-index: 99;
}

.tab {
  flex: 1;
  padding: 14px 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.25s;
}

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

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

/* === VIEWS === */
.view {
  display: none;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.view.active {
  display: block;
}

/* === FILTER BAR === */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.input-select {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
}

/* === HISTORY TABLE === */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.history-table th,
.history-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.history-table th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.2);
}

.history-table tr {
  transition: background 0.15s;
}

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.history-table tbody tr:active {
  background: rgba(255, 255, 255, 0.06);
}

.table-date {
  font-weight: 600;
  color: var(--accent);
}

.table-time {
  font-size: 12px;
  color: var(--text-muted);
}

.badge-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.table-text-cell {
  max-width: 200px;
}

.table-text-snippet {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.table-text-snippet strong {
  color: var(--text-muted);
  font-size: 11px;
  margin-right: 4px;
}

.table-duration {
  font-size: 12px;
  color: var(--text-muted);
}

.table-user {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Mobile optimization for table */
@media (max-width: 768px) {

  .history-table th,
  .history-table td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .table-text-cell {
    max-width: 120px;
  }

  .badge {
    padding: 2px 6px;
    font-size: 10px;
  }
}

/* === BADGES === */

/* === FORM === */
.entry-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.optional {
  font-weight: 400;
  text-transform: none;
  font-size: 11px;
}

.input {
  padding: 14px 16px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 16px;
  transition: border-color 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.textarea {
  resize: vertical;
  min-height: 80px;
}

/* === CHIP GROUP === */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 10px 16px;
  background: var(--bg-input);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 30px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.chip:hover {
  border-color: var(--primary);
}

.chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: scale(1.05);
}

/* === STATUS BUTTONS === */
.status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-btn {
  padding: 12px 14px;
  background: var(--bg-input);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  min-width: 100px;
  text-align: center;
}

.status-btn.selected {
  transform: scale(1.03);
}

.status-btn.selected {
  border-color: var(--success);
  background: rgba(0, 184, 148, 0.15);
  color: var(--success);
}

.status-warn.selected {
  border-color: var(--warning);
  background: rgba(253, 203, 110, 0.15);
  color: var(--warning);
}

.status-critical.selected {
  border-color: var(--critical);
  background: rgba(214, 48, 49, 0.15);
  color: var(--critical);
}

.status-phone.selected {
  border-color: var(--phone);
  background: rgba(9, 132, 227, 0.15);
  color: var(--phone);
}

.status-progress.selected {
  border-color: var(--accent);
  background: rgba(0, 206, 201, 0.15);
  color: var(--accent);
}

/* === SLIDER === */
.slider {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 4px;
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.4);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dauer-value {
  color: var(--accent);
  font-weight: 700;
  font-size: 16px;
}

/* === BUTTONS === */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #8b7cf7);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #55efc4);
  color: #000;
}

.btn-danger {
  background: rgba(225, 112, 85, 0.15);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-large {
  padding: 18px 24px;
  font-size: 16px;
}

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

/* Google Button */
.btn-google {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  font-size: 16px;
}

.btn-google:hover {
  background: #f8f8f8;
  box-shadow: var(--shadow);
}

.google-icon {
  vertical-align: middle;
  margin-right: 8px;
}

/* === REPORT === */
.report-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
}

.report-card h2 {
  margin-bottom: 20px;
  font-size: 20px;
}

.report-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.report-status {
  margin-top: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 24px;
  background: var(--bg-card);
  color: var(--text);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 90%;
}

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

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

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

/* === MODAL === */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow-y: auto;
  padding: 20px;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 18px;
}

.modal-close {
  font-size: 28px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* === LOGIN === */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1117 0%, #1a1d27 50%, #2d3142 100%);
}

.login-container {
  padding: 20px;
  width: 100%;
  max-width: 400px;
}

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

.login-logo {
  font-size: 64px;
  margin-bottom: 16px;
}

.login-card h1 {
  font-size: 28px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.login-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 20px;
}

/* === LOADING === */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
}