/* Smart Elderly Item Locator - Care Theme & Senior UI */

:root {
  --primary-color: #3B82F6;
  --primary-hover: #2563EB;
  --accent-warm: #F59E0B;
  --accent-green: #10B981;
  --accent-red: #EF4444;
  --bg-gradient: linear-gradient(135deg, #F8FAFC 0%, #EFF6FF 50%, #F0FDF4 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-main: #0F172A;
  --text-muted: #475569;
  --border-color: #CBD5E1;
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 20px 35px -5px rgba(59, 130, 246, 0.15);
  --radius-lg: 20px;
  --radius-md: 14px;
  
  /* Senior Font Sizing default */
  --font-title: 32px;
  --font-subtitle: 24px;
  --font-body: 22px;
  --font-small: 18px;
  --input-height: 68px;
}

/* Base Setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 60px;
  line-height: 1.5;
}

/* App Container */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* Header & Mode Bar */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 40px;
  background: #DBEAFE;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
}

.brand-title {
  font-size: var(--font-title);
  font-weight: 800;
  color: #1E3A8A;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 500;
}

.mode-toggle-btn {
  background: #EEF2FF;
  color: #3730A3;
  border: 2px solid #C7D2FE;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.mode-toggle-btn:hover {
  background: #E0E7FF;
  transform: translateY(-2px);
}

/* Main Search Box Area (Senior Centric) */
.search-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 2px solid #93C5FD;
  margin-bottom: 28px;
}

.search-label {
  font-size: var(--font-subtitle);
  font-weight: 800;
  color: #1E293B;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-input-wrapper {
  display: flex;
  gap: 12px;
  position: relative;
}

.search-input {
  flex: 1;
  height: var(--input-height);
  font-size: 26px;
  font-weight: 700;
  padding: 0 24px;
  border-radius: 20px;
  border: 3px solid #60A5FA;
  background: #FFFFFF;
  color: #0F172A;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}

.search-input:focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.2);
}

.search-clear-btn {
  position: absolute;
  right: 175px;
  top: 50%;
  transform: translateY(-50%);
  background: #E2E8F0;
  border: none;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: #64748B;
}

/* Big Buttons */
.btn-primary {
  height: var(--input-height);
  padding: 0 28px;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 20px;
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.45);
}

.btn-voice {
  height: var(--input-height);
  padding: 0 20px;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 20px;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
  transition: all 0.2s ease;
}

.btn-voice:hover {
  transform: translateY(-2px);
}

.btn-voice.listening {
  animation: pulse-orange 1.2s infinite;
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

@keyframes pulse-orange {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Quick Pills Section */
.quick-tags-container {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.quick-tag-title {
  font-size: 18px;
  font-weight: 700;
  color: #475569;
}

.quick-pill {
  background: #EFF6FF;
  border: 2px solid #BFDBFE;
  color: #1E40AF;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-pill:hover, .quick-pill.active {
  background: #2563EB;
  color: #FFFFFF;
  border-color: #2563EB;
}

/* Results Count Bar */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 0 8px;
}

.results-title {
  font-size: var(--font-subtitle);
  font-weight: 800;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-badge {
  background: #3B82F6;
  color: #FFFFFF;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 18px;
}

/* Room Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 20px;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  background: #FFFFFF;
  border: 2px solid #E2E8F0;
  color: #475569;
  padding: 8px 16px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.filter-chip.active {
  background: #1E293B;
  color: #FFFFFF;
  border-color: #1E293B;
}

/* Item List Cards (Extreme Readability for Elderly) */
.item-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.item-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  border: 2px solid #E2E8F0;
  transition: all 0.25 ease;
  position: relative;
  overflow: hidden;
}

.item-card:hover {
  border-color: #60A5FA;
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.item-name {
  font-size: 28px;
  font-weight: 900;
  color: #0F172A;
  line-height: 1.3;
}

.room-badge {
  background: #FEF3C7;
  color: #92400E;
  border: 2px solid #FDE68A;
  font-size: 20px;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 30px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.item-location-box {
  background: linear-gradient(135deg, #FEF2F2 0%, #FFFBEB 100%);
  border: 2px dashed #FCA5A5;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.item-location-label {
  font-size: 16px;
  font-weight: 800;
  color: #991B1B;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.item-location-text {
  font-size: var(--font-body);
  font-weight: 800;
  color: #7F1D1D;
  line-height: 1.4;
}

.item-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 18px;
  color: var(--text-muted);
}

.item-notes {
  background: #F8FAFC;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 18px;
  color: #334155;
  border-left: 4px solid #94A3B8;
  margin-bottom: 16px;
}

/* Card Action Buttons */
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn-tts {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #FFFFFF;
  border: none;
  padding: 12px 24px;
  border-radius: 16px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.btn-tts:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-view-photo {
  background: #EFF6FF;
  color: #2563EB;
  border: 2px solid #BFDBFE;
  padding: 10px 20px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-view-photo:hover {
  background: #DBEAFE;
}

.admin-card-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.btn-edit {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: #475569;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.btn-delete {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #DC2626;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.empty-title {
  font-size: 26px;
  font-weight: 800;
  color: #334155;
  margin-bottom: 8px;
}

.empty-subtitle {
  font-size: 20px;
  color: #64748B;
  margin-bottom: 20px;
}

/* Admin Drawer / Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
}

.modal-card {
  background: #FFFFFF;
  border-radius: 24px;
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modal-slide-up 0.3s ease-out;
}

@keyframes modal-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #F1F5F9;
  padding-bottom: 16px;
}

.modal-title {
  font-size: 24px;
  font-weight: 800;
  color: #0F172A;
}

.modal-close {
  background: #F1F5F9;
  border: none;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 14px 18px;
  font-size: 18px;
  border-radius: 12px;
  border: 2px solid #CBD5E1;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #2563EB;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Image Modal */
.image-preview-content {
  text-align: center;
}

.image-preview-img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

/* Toast Notice */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1E293B;
  color: #FFFFFF;
  padding: 14px 28px;
  border-radius: 30px;
  font-size: 20px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  z-index: 2000;
  opacity: 0;
}

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

/* Responsive adjustments */
@media (max-width: 640px) {
  :root {
    --font-title: 26px;
    --font-subtitle: 20px;
    --font-body: 20px;
    --input-height: 60px;
  }
  .search-input-wrapper {
    flex-direction: column;
  }
  .btn-primary, .btn-voice {
    width: 100%;
    justify-content: center;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
