/**
 * HLC Assist - Voice AI Assistant
 * Clean white design with animated orb
 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  background: #ffffff;
  color: #1e293b;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  position: relative;
}

/* ===== CONTAINER ===== */
.container {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: max(32px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  z-index: 1;
  position: relative;
}

/* ===== BRAND ===== */
.brand {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ===== USER INFO ===== */
.user-info {
  width: 100%;
  max-width: 650px;
  display: flex;
  justify-content: flex-end;
  padding: 0 8px;
  margin-top: -8px;
  margin-bottom: 8px;
}

.user-email {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f1f5f9;
  border-radius: 12px;
  font-size: 14px;
  color: #475569;
  font-weight: 500;
}

.user-email i {
  font-size: 18px;
  color: #64748b;
}

/* ===== MAIN CARD ===== */
.main-card {
  width: 100%;
  max-width: 650px;
  background: #ffffff;
  border-radius: 32px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: center;
}

/* ===== MAIN CONTROL BUTTON (BIG CIRCLE) ===== */
.main-control-btn {
  width: 280px;
  height: 280px;
  border-radius: 50%;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  background: transparent;
  transition: all 0.3s ease;
}

.main-control-btn:hover:not(:disabled) {
  transform: scale(1.05);
}

.main-control-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.main-control-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.animated-orb {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(135deg, #fb923c 0%, #f97316 50%, #ea580c 100%);
  box-shadow: 
    0 20px 60px rgba(249, 115, 22, 0.3),
    inset -20px -20px 40px rgba(234, 88, 12, 0.4),
    inset 20px 20px 40px rgba(251, 146, 60, 0.4);
  position: absolute;
  top: 0;
  left: 0;
  transition: all 0.5s ease;
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.animated-orb.active {
  opacity: 1;
  transform: scale(1);
  animation: orbFloat 4s ease-in-out infinite;
  pointer-events: none;
}

.animated-orb i {
  font-size: 64px;
  color: white;
  z-index: 10;
  position: relative;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.animated-orb.active i {
  opacity: 1;
}

/* Muted state for orb */
.animated-orb.muted {
  background: linear-gradient(135deg, #94a3b8 0%, #64748b 50%, #475569 100%);
  box-shadow: 
    0 20px 60px rgba(100, 116, 139, 0.3),
    inset -20px -20px 40px rgba(71, 85, 105, 0.4),
    inset 20px 20px 40px rgba(148, 163, 184, 0.4);
  animation: orbPulse 2s ease-in-out infinite;
}

@keyframes orbPulse {
  0%, 100% {
    opacity: 0.7;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Glossy highlights */
.animated-orb::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 20%;
  width: 40%;
  height: 40%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(20px);
  pointer-events: none;
}

.animated-orb::after {
  content: '';
  position: absolute;
  bottom: 20%;
  right: 20%;
  width: 30%;
  height: 30%;
  background: radial-gradient(circle, rgba(234, 88, 12, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(25px);
  pointer-events: none;
}

@keyframes orbFloat {
  0%, 100% {
    transform: scale(1) translateY(0);
  }
  50% {
    transform: scale(1.03) translateY(-8px);
  }
}

/* Placeholder when disconnected */
.orb-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.5s ease;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.orb-placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}

.orb-placeholder i {
  font-size: 80px;
  color: white;
}

/* ===== STATUS SECTION ===== */
.status-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: 500px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-height: 24px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  transition: all 0.3s ease;
  position: relative;
  opacity: 0;
}

.status-dot::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: none;
}

.status-dot.connected {
  background: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
  opacity: 1;
}

.status-dot.connected::after {
  animation: ping 2s infinite;
}

.status-dot.connecting {
  background: #fbbf24;
  animation: pulse 1.5s infinite;
  opacity: 1;
}

.status-dot.error {
  background: #ef4444;
  opacity: 1;
}

@keyframes ping {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

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

.status-indicator span:last-child {
  font-size: 16px;
  font-weight: 500;
  color: #475569;
}

/* ===== TIMER ===== */
.timer {
  font-size: 18px;
  font-weight: 600;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}

/* ===== MUTE BUTTON ===== */
.mute-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 12px 20px;
  border-radius: 16px;
}

.mute-btn:hover:not(:disabled) {
  background: #f1f5f9;
  color: #475569;
}

.mute-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.mute-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.mute-btn i {
  font-size: 28px;
}

.mute-btn span {
  font-size: 14px;
  font-weight: 600;
}

.mute-btn.muted {
  color: #ffffff;
  background: #ef4444;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.mute-btn.muted:hover:not(:disabled) {
  background: #dc2626;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.5);
}

/* ===== LOGOUT BUTTON ===== */
.logout-btn {
  margin-top: 16px;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  z-index: 2;
}

.logout-btn:hover {
  background: #fee2e2;
  color: #ef4444;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.2);
}

.logout-btn:active {
  transform: translateY(0);
}

.logout-btn i {
  font-size: 18px;
}

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: #ffffff;
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  text-align: center;
  margin-bottom: 32px;
  flex-shrink: 0;
}

.modal-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #3b82f6;
}

.modal-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}

.modal-subtitle {
  font-size: 15px;
  color: #64748b;
}

.modal-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 32px;
  padding-right: 8px;
  min-height: 200px;
}

.modal-messages::-webkit-scrollbar {
  width: 6px;
}

.modal-messages::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.modal-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.modal-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.message-bubble {
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

.message-bubble.user {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  margin-left: auto;
  text-align: right;
}

.message-bubble.assistant {
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  margin-right: auto;
  text-align: left;
}

.message-role {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.message-bubble.user .message-role {
  color: #3b82f6;
}

.message-bubble.assistant .message-role {
  color: #10b981;
}

.message-text {
  font-size: 15px;
  line-height: 1.6;
  color: #1e293b;
  word-wrap: break-word;
}

.modal-actions {
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}

.modal-actions button {
  flex: 1;
  height: 64px;
  min-height: 64px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-actions button i {
  font-size: 20px;
}

.modal-actions button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.modal-actions button:active:not(:disabled) {
  transform: translateY(0);
}

.btn-upload {
  background: #10b981;
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-upload:hover:not(:disabled) {
  background: #059669;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.btn-discard {
  background: #f1f5f9;
  color: #64748b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.btn-discard:hover:not(:disabled) {
  background: #fee2e2;
  color: #ef4444;
}

/* ===== PROCESSING MODAL ===== */
.processing-modal {
  max-width: 400px;
}

.spinner-container {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #3b82f6;
}

.processing-modal .modal-header {
  text-align: center;
  margin-bottom: 0;
}

.processing-modal .modal-subtitle {
  color: #64748b;
}

/* ===== COMMENTS MODAL ===== */
.comments-modal {
  max-width: 600px;
}

.modal-icon.success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #10b981;
}

.comments-list {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 24px;
}

.comments-list::-webkit-scrollbar {
  width: 6px;
}

.comments-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.comments-list::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.comment-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  animation: fadeIn 0.3s ease;
}

.comment-card:last-child {
  margin-bottom: 0;
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.comment-header i {
  font-size: 18px;
  color: #3b82f6;
}

.comment-patient {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  text-transform: capitalize;
}

.comment-text {
  font-size: 14px;
  line-height: 1.6;
  color: #475569;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.empty-comments {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.empty-comments i {
  font-size: 64px;
  color: #cbd5e1;
  margin-bottom: 16px;
}

.empty-comments p {
  font-size: 16px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}

.empty-note {
  font-size: 14px;
  color: #94a3b8;
}

.btn-primary {
  width: 100%;
  height: 56px;
  border-radius: 12px;
  border: none;
  background: #3b82f6;
  color: white;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ===== LOGIN MODAL ===== */
.login-modal {
  max-width: 450px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-form input[type="email"] {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  color: #1e293b;
  background: #ffffff;
  transition: all 0.3s ease;
  outline: none;
}

.login-form input[type="email"]:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-form input[type="email"]::placeholder {
  color: #94a3b8;
}

.login-form input[type="email"].error {
  border-color: #ef4444;
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.error-message {
  min-height: 20px;
  color: #ef4444;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.btn-login {
  width: 100%;
  height: 56px;
  border-radius: 12px;
  border: none;
  background: #3b82f6;
  color: white;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-login:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login i {
  font-size: 20px;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Desktop */
@media (min-width: 1024px) {
  .main-card {
    max-width: 700px;
    padding: 48px;
  }

  .main-control-btn {
    width: 320px;
    height: 320px;
  }

  .orb-placeholder i {
    font-size: 90px;
  }

  .animated-orb i {
    font-size: 72px;
  }

  .timer {
    font-size: 20px;
  }

  .mute-btn i {
    font-size: 32px;
  }

  .mute-btn span {
    font-size: 15px;
  }
}

/* Tablets */
@media (max-width: 768px) {
  .container {
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    gap: 24px;
  }

  .brand {
    font-size: 18px;
  }

  .user-email {
    font-size: 13px;
    padding: 6px 12px;
  }

  .user-email i {
    font-size: 16px;
  }

  .main-card {
    padding: 32px 24px;
    border-radius: 28px;
  }

  .main-control-btn {
    width: 240px;
    height: 240px;
  }

  .orb-placeholder i {
    font-size: 70px;
  }

  .animated-orb i {
    font-size: 56px;
  }

  .timer {
    font-size: 16px;
  }

  .modal-content {
    padding: 36px 28px;
    max-height: 90vh;
  }

  .modal-messages {
    min-height: 200px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 16px;
  }

  .modal-actions button {
    height: 64px;
    min-height: 64px;
  }

  .comments-list {
    max-height: 300px;
  }

  .comment-card {
    padding: 14px;
  }

  .comment-text {
    font-size: 13px;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .container {
    padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    gap: 20px;
  }

  .brand {
    font-size: 17px;
  }

  .user-email {
    font-size: 12px;
    padding: 6px 10px;
    gap: 6px;
  }

  .user-email i {
    font-size: 14px;
  }

  .main-card {
    padding: 28px 20px;
    border-radius: 24px;
    gap: 28px;
  }

  .main-control-btn {
    width: 200px;
    height: 200px;
  }

  .orb-placeholder i {
    font-size: 60px;
  }

  .animated-orb i {
    font-size: 48px;
  }

  .status-section {
    gap: 12px;
  }

  .status-indicator span:last-child {
    font-size: 14px;
  }

  .timer {
    font-size: 15px;
    min-width: 50px;
  }

  .mute-btn i {
    font-size: 26px;
  }

  .mute-btn span {
    font-size: 13px;
  }

  .modal-content {
    padding: 28px 20px;
    border-radius: 20px;
    max-height: 92vh;
  }

  .modal-icon {
    width: 56px;
    height: 56px;
    font-size: 28px;
    margin-bottom: 16px;
  }

  .modal-header {
    margin-bottom: 24px;
  }

  .modal-header h2 {
    font-size: 22px;
  }

  .modal-subtitle {
    font-size: 13px;
  }

  .modal-messages {
    min-height: 180px;
    margin-bottom: 24px;
  }

  .message-bubble {
    max-width: 90%;
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .message-text {
    font-size: 14px;
    line-height: 1.5;
  }

  .modal-actions {
    gap: 20px;
  }

  .modal-actions button {
    height: 66px;
    min-height: 66px;
    font-size: 15px;
    padding: 0 20px;
  }

  .comments-list {
    max-height: 250px;
  }

  .comment-card {
    padding: 12px;
  }

  .comment-header i {
    font-size: 16px;
  }

  .comment-patient {
    font-size: 13px;
  }

  .comment-text {
    font-size: 13px;
  }

  .empty-comments i {
    font-size: 48px;
  }

  .empty-comments p {
    font-size: 15px;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .main-card {
    padding: 24px 16px;
  }

  .main-control-btn {
    width: 180px;
    height: 180px;
  }

  .orb-placeholder i {
    font-size: 50px;
  }

  .animated-orb i {
    font-size: 42px;
  }

  .timer {
    font-size: 14px;
  }

  .modal-content {
    padding: 24px 18px;
    max-height: 94vh;
  }

  .modal-messages {
    min-height: 160px;
  }

  .modal-actions {
    gap: 18px;
  }

  .modal-actions button {
    height: 64px;
    min-height: 64px;
    font-size: 14px;
  }
}

/* Landscape mode */
@media (max-height: 600px) and (orientation: landscape) {
  .container {
    padding: 16px;
    gap: 16px;
  }

  .brand {
    font-size: 16px;
  }

  .main-card {
    padding: 24px;
    gap: 20px;
  }

  .main-control-btn {
    width: 140px;
    height: 140px;
  }

  .orb-placeholder i {
    font-size: 40px;
  }

  .animated-orb i {
    font-size: 36px;
  }

  .modal-content {
    max-height: 90vh;
    padding: 24px 28px;
  }

  .modal-messages {
    min-height: 150px;
  }
}

/* ===== ACCESSIBILITY ===== */
button:focus {
  outline: 3px solid rgba(59, 130, 246, 0.5);
  outline-offset: 3px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

/* Remove animated background elements */
.animated-bg {
  display: none;
}

/* ===== ANIMATIONS ===== */
.rotating {
  animation: rotate 1s linear infinite;
}

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