﻿@import url(https://fonts.googleapis.com/css?family=Share+Tech+Mono);

/* CSS Reset and Custom Properties */
:root {
  /* Colors */
  --background: hsl(0 0% 100%);
  --foreground: hsl(222.2 84% 4.9%);
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(222.2 84% 4.9%);
  --popover: hsl(0 0% 100%);
  --popover-foreground: hsl(222.2 84% 4.9%);
  --primary: hsl(221.2 83.2% 53.3%);
  --primary-foreground: hsl(210 40% 98%);
  --secondary: hsl(210 40% 96%);
  --secondary-foreground: hsl(222.2 84% 4.9%);
  --muted: hsl(210 40% 96%);
  --muted-foreground: hsl(215.4 16.3% 46.9%);
  --accent: hsl(210 40% 96%);
  --accent-foreground: hsl(222.2 84% 4.9%);
  --destructive: hsl(0 84.2% 60.2%);
  --destructive-foreground: hsl(210 40% 98%);
  --success: hsl(142.1 76.2% 36.3%);
  --success-foreground: hsl(355.7 100% 97.3%);
  --border: hsl(214.3 31.8% 91.4%);
  --input: hsl(214.3 31.8% 91.4%);
  --ring: hsl(221.2 83.2% 53.3%);
  --radius: 0.5rem;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Roboto",
    sans-serif;
  line-height: 1.5;
  background-color: var(--background);
  color: var(--foreground);
  min-height: 100vh;
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: var(--spacing-lg) var(--spacing-xl);
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--foreground);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}

/* Main Content */
.app-main {
  flex: 1;
  padding: var(--spacing-xl);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
  align-items: start;
}

/* Card Styles */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card-header {
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

.card-content {
  padding: var(--spacing-lg);
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  white-space: nowrap;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  outline: none;
  padding: var(--spacing-sm) var(--spacing-md);
}

.btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-sm {
  font-size: 0.75rem;
  padding: var(--spacing-xs) var(--spacing-sm);
}

.btn-large {
  font-size: 1rem;
  padding: var(--spacing-md) var(--spacing-lg);
  min-height: 3rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover {
  background: hsl(221.2 83.2% 48%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

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

.btn-success {
  background: var(--success);
  color: var(--success-foreground);
}

.btn-success:hover {
  background: hsl(142.1 76.2% 32%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-danger {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-danger:hover {
  background: hsl(0 84.2% 55%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

/* Loading Spinner */
.loading-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none !important;
}

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

/* Device Info Styles */
.client-name {
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted-foreground);
  padding: var(--spacing-md);
  background: var(--muted);
  border-radius: var(--radius);
  margin-bottom: var(--spacing-md);
}

.device-selection {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.device-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.device-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.device-select {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-sm);
  font-size: 0.875rem;
  min-height: 2.5rem;
}

.device-select:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Quick Dial Contacts */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--spacing-md);
}

/* Loading state for contacts */
.loading-contacts {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--muted-foreground);
  font-style: italic;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}

.loading-contacts p {
  margin: 0;
  font-size: 0.875rem;
}

.contact-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.contact-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.contact-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: hsl(215.4 16.3% 46.9%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.contact-info {
  flex: 1;
  min-width: 0;
}

.contact-name {
  font-weight: 500;
  color: var(--foreground);
  font-size: 0.875rem;
}

.contact-number {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.contact-call-btn {
  background: hsl(215.4 16.3% 56.9%);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  min-width: 3rem;
}

.contact-call-btn:hover {
  background: hsl(215.4 16.3% 46.9%);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Call Controls */
.call-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.input-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
}

.phone-input {
  padding: var(--spacing-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--background);
  transition: border-color 0.2s ease-in-out;
}

.phone-input:focus {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-color: var(--ring);
}

.phone-input::placeholder {
  color: var(--muted-foreground);
}

/* Incoming Call Styles */
.incoming-call-section {
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  margin: var(--spacing-md) 0;
}

.incoming-call-header {
  margin-bottom: var(--spacing-md);
}

.incoming-call-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: var(--spacing-sm);
}

.incoming-call-info {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.incoming-label {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.incoming-number {
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
}

.incoming-call-actions {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

/* Volume Indicators */
.volume-section {
  background: var(--muted);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-md);
}

.volume-group {
  margin-bottom: var(--spacing-md);
}

.volume-group:last-child {
  margin-bottom: 0;
}

.volume-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: var(--spacing-sm);
  display: block;
}

.volume-bar-container {
  background: var(--background);
  border-radius: var(--radius);
  height: 0.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
}

.volume-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success) 0%, hsl(60 84.2% 60.2%) 50%, var(--destructive) 100%);
  width: 0%;
  transition: width 0.1s ease-out;
  border-radius: var(--radius);
}

/* Event Log */
.event-log {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 300px;
  overflow-y: auto;
  padding: var(--spacing-md);
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.4;
}

.log-entry {
  color: var(--muted-foreground);
  margin-bottom: var(--spacing-xs);
  padding: var(--spacing-xs) 0;
  border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* Utility Classes */
.hide {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-main {
    grid-template-columns: 1fr;
    padding: var(--spacing-md);
  }

  .header-content {
    flex-direction: column;
    gap: var(--spacing-md);
    text-align: center;
  }

  .contacts-grid {
    grid-template-columns: 1fr;
  }

  .incoming-call-actions {
    flex-direction: column;
  }

  .contact-card {
    padding: var(--spacing-sm);
  }

  .btn-large {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: var(--spacing-md);
  }

  .card-content {
    padding: var(--spacing-md);
  }

  .card-header {
    padding: var(--spacing-md);
  }
}

/* Recording and Transcription Styles */
.recording-status-card {
  margin-bottom: var(--spacing-lg);
}

.recording-status {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.recording-info {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.recording-indicator {
  font-size: 1.2rem;
  display: inline-block;
}

@keyframes pulse {
  0%,
  50% {
    opacity: 1;
  }
  25%,
  75% {
    opacity: 0.5;
  }
}

.recording-text {
  font-weight: 500;
  color: var(--foreground);
}

.recording-note {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.recordings-card {
  margin-bottom: var(--spacing-lg);
}

.recordings-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recordings-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.recording-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  background: var(--card);
  transition: all 0.2s ease-in-out;
}

.recording-card:hover {
  box-shadow: var(--shadow-md);
}

.recording-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-sm);
}

.recording-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.recording-id {
  font-weight: 500;
  color: var(--foreground);
  font-size: 0.875rem;
}

.recording-status {
  font-size: 0.75rem;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: calc(var(--radius) / 2);
  font-weight: 500;
}

.recording-status.has-transcript {
  background: var(--success);
  color: var(--success-foreground);
}

.recording-status.no-transcript {
  background: var(--muted);
  color: var(--muted-foreground);
}

.recording-actions {
  display: flex;
  gap: var(--spacing-xs);
}

.recording-preview {
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--border);
}

.recording-preview p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.4;
}

.no-recordings,
.loading-recordings {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--muted-foreground);
}

/* Responsive adjustments for recordings */
@media (max-width: 768px) {
  .recording-header {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: stretch;
  }

  .recording-actions {
    width: 100%;
    justify-content: center;
  }

  .recordings-card .card-header {
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: stretch;
  }
}
