/* CSS Custom Properties — set from brand-config.js at runtime */
:root {
  --primary-color: #0066CC;
  --accent-color: #004499;
  --background-color: #FFFFFF;
  --text-color: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --danger-color: #CC0000;
  --success-color: #00AA44;
  --warning-color: #FF8800;
  --urgent-color: #CC0000;
  --card-bg: #FFFFFF;
  --screen-bg: #f5f5f5;
  --header-height: 56px;
}

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

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

/* Screens */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* Auth Screen */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  min-height: 100vh;
  background: var(--background-color);
}

.brand-logo {
  width: 120px;
  height: auto;
  margin-bottom: 1rem;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.input-field {
  width: 100%;
  max-width: 280px;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}
.input-field:focus {
  border-color: var(--primary-color);
}

.pin-display {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  transition: all 0.2s;
}
.pin-dot.filled {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

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

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 12px;
  margin-bottom: 1rem;
}

.key-btn {
  width: 72px;
  height: 56px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--card-bg);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text-color);
}
.key-btn:active {
  background: var(--primary-color);
  color: white;
  transform: scale(0.95);
}
.key-btn-submit {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.error-text {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: var(--header-height);
  background: var(--primary-color);
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  height: 32px;
  width: auto;
}

.header-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.icon-btn {
  background: none;
  border: none;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.5rem;
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--background-color);
  border-bottom: 1px solid var(--border-color);
}

.filter-btn {
  padding: 0.4rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--background-color);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-secondary);
}
.filter-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Message List */
.message-list {
  flex: 1;
  padding: 0.5rem;
}

.loading-text {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.message-card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  margin-bottom: 0.5rem;
  background: var(--card-bg);
  border-radius: 8px;
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.message-card:active {
  transform: scale(0.98);
}
.message-card.unread {
  border-left-color: var(--primary-color);
  font-weight: 600;
}
.message-card.urgent {
  border-left-color: var(--urgent-color);
}

.message-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.message-sender {
  font-size: 0.875rem;
  font-weight: 600;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.message-preview {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-badges {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
}
.badge-urgent {
  background: #fde8e8;
  color: var(--urgent-color);
}
.badge-acknowledged {
  background: #e8f5e9;
  color: var(--success-color);
}
.badge-called {
  background: #e3f2fd;
  color: var(--primary-color);
}

/* Message Detail */
.message-detail {
  padding: 1.5rem 1rem;
  flex: 1;
}

.detail-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.detail-sender {
  font-weight: 600;
  font-size: 1rem;
}

.detail-time {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.priority-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #fde8e8;
  color: var(--urgent-color);
  margin-bottom: 1rem;
}

.detail-body {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--screen-bg);
  border-radius: 8px;
  white-space: pre-wrap;
}

.detail-callback {
  padding: 1rem;
  background: #e3f2fd;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  text-align: center;
}

.callback-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.detail-status {
  margin-top: 1rem;
  padding: 1rem;
  background: #e8f5e9;
  border-radius: 8px;
  text-align: center;
  color: var(--success-color);
  font-weight: 600;
}

/* Buttons */
.btn {
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary-color);
  color: white;
}
.btn-accent {
  background: var(--accent-color);
  color: white;
}
.btn-secondary {
  background: var(--background-color);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}
.btn-danger {
  background: var(--danger-color);
  color: white;
}

/* Reply */
.reply-container {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.reply-textarea {
  flex: 1;
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  outline: none;
  margin-bottom: 1rem;
}
.reply-textarea:focus {
  border-color: var(--primary-color);
}

/* Call Screen */
.call-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem;
}

.call-animation {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.call-pulse {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary-color);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.call-status-text {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 2rem;
  color: var(--text-color);
}

/* Load More */
.load-more-container {
  padding: 1rem;
  text-align: center;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (min-width: 600px) {
  .auth-container { padding: 3rem; }
  .pin-keypad { gap: 16px; }
  .key-btn { width: 80px; height: 64px; font-size: 1.5rem; }
  .message-list { max-width: 600px; margin: 0 auto; }
  .message-detail { max-width: 600px; margin: 0 auto; }
}
