:root {
    --primary-color: #2196F3;
    --primary-light: #E3F2FD;
    --primary-dark: #1976D2;
    --surface-color: #ffffff;
    --background-color: #f5f7fa;
    --text-primary: #121212;
    --text-secondary: #757575;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 12px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'SF Pro Display', 'HarmonyOS Sans', 'MIUI', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  }
  
  * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    transition: all var(--transition-normal);
    overflow: hidden;
  }
  
  .app-container {
    background-color: var(--surface-color);
    width: 92%;
    max-width: 420px;
    height: 90vh;
    max-height: 800px;
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: translateY(0);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  }
  
  @media (min-width: 768px) {
    .app-container {
      max-width: 720px;
    }
  }
  
  .header {
    padding: 20px;
    background-color: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 10;
  }
  
  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .logo {
    width: 36px;
    height: 36px;
    background-color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(33, 150, 243, 0.3);
    position: relative;
    overflow: hidden;
  }
  
  .logo::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background-color: var(--surface-color);
    border-radius: 50%;
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  }
  
  .logo:hover::after {
    transform: scale(1);
  }
  
  .logo i {
    color: white;
    font-size: 18px;
    position: relative;
    z-index: 1;
  }
  
  .brand-name {
    font-size: 20px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
  }
  
  .actions {
    display: flex;
    gap: 8px;
  }
  
  .btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--background-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
  }
  
  .btn-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--primary-light);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-normal);
  }
  
  .btn-icon:hover {
    color: var(--primary-color);
  }
  
  .btn-icon:hover::after {
    opacity: 1;
    transform: scale(1);
  }
  
  .btn-icon i {
    position: relative;
    z-index: 1;
  }
  
  .chat-window {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
    background-color: var(--background-color);
    position: relative;
  }
  
  .chat-window::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, var(--background-color), rgba(245, 247, 250, 0));
    z-index: 2;
    pointer-events: none;
  }
  
  .chat-window::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to top, var(--background-color), rgba(245, 247, 250, 0));
    z-index: 2;
    pointer-events: none;
  }
  
  .date-divider {
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
    margin: 24px 0;
    position: relative;
  }
  
  .date-divider::before {
    content: '';
    position: absolute;
    height: 1px;
    background-color: rgba(0, 0, 0, 0.06);
    top: 50%;
    left: 0;
    right: 0;
    z-index: -1;
  }
  
  .date-divider span {
    background-color: var(--background-color);
    padding: 0 12px;
  }
  
  .chat-message {
    margin: 12px 0;
    padding: 16px;
    border-radius: var(--border-radius-md);
    max-width: 85%;
    line-height: 1.5;
    position: relative;
    transition: all var(--transition-normal);
    animation: fadeIn 0.3s ease-out forwards;
  }
  
  .chat-message p {
    margin: 0;
  }
  
  .user {
    background-color: var(--primary-light);
    margin-left: auto;
    color: var(--text-primary);
    border-bottom-right-radius: 6px;
    box-shadow: var(--shadow-sm);
  }
  
  .ai {
    background-color: var(--surface-color);
    margin-right: auto;
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    box-shadow: var(--shadow-sm);
  }
  
  .ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    position: absolute;
    bottom: -5px;
    left: -5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
  }
  
  .user::before, .ai::before {
    content: '';
    position: absolute;
    bottom: 0;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    transform: rotate(45deg);
  }
  
  .user::before {
    background-color: var(--primary-light);
    right: -5px;
    box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.02);
  }
  
  .ai::before {
    background-color: var(--surface-color);
    left: -5px;
    box-shadow: -2px 2px 2px rgba(0, 0, 0, 0.02);
  }
  
  .input-container {
    padding: 16px 20px;
    background-color: var(--surface-color);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    z-index: 5;
  }
  
  .input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--background-color);
    border-radius: var(--border-radius-lg);
    padding: 4px 8px 4px 16px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
  }
  
  .input-wrapper:focus-within {
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.3), var(--shadow-sm);
  }
  
  form {
    display: flex;
    flex: 1;
    align-items: center;
  }
  
  input {
    flex: 1;
    padding: 12px 0;
    font-size: 16px;
    border: none;
    background-color: transparent;
    color: var(--text-primary);
    font-family: var(--font-family);
  }
  
  input::placeholder {
    color: var(--text-secondary);
  }
  
  input:focus {
    outline: none;
  }
  
  .btn-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
    transform: rotate(-45deg);
  }
  
  .btn-send:hover {
    background-color: var(--primary-dark);
    transform: rotate(-45deg) scale(1.05);
    box-shadow: 0 3px 12px rgba(33, 150, 243, 0.4);
  }
  
  .btn-send:active {
    transform: rotate(-45deg) scale(0.95);
  }
  
  .btn-action {
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
  }
  
  .btn-action::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-normal);
  }
  
  .btn-action:hover {
    color: var(--primary-color);
  }
  
  .btn-action:hover::after {
    opacity: 1;
    transform: scale(1);
  }
  
  .btn-action i {
    position: relative;
    z-index: 1;
  }
  
  /* Modal styles */
  .modal {
    display: flex;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    justify-content: center;
    align-items: center;
  }
  
  .modal.show {
    opacity: 1;
    pointer-events: auto;
  }
  
  .modal-content {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  }
  
  .modal.show .modal-content {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
  }
  
  .modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
  }
  
  .close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--background-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
  }
  
  .close-modal:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
    transform: rotate(90deg);
  }
  
  .settings-section {
    margin-top: 24px;
  }
  
  .settings-section h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 16px;
  }
  
  .model-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .model-option {
    display: flex;
    align-items: center;
    padding: 16px;
    background-color: var(--background-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
  }
  
  .model-option::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--primary-light);
    left: 0;
    top: 0;
    opacity: 0;
    transition: opacity var(--transition-normal);
  }
  
  .model-option:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
  }
  
  .model-option:hover::before {
    opacity: 0.3;
  }
  
  .model-option-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    width: 100%;
  }
  
  .model-option input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
  }
  
  .model-info {
    flex: 1;
  }
  
  .model-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
  }
  
  .model-description {
    font-size: 12px;
    color: var(--text-secondary);
  }
  
  .option-tag {
    font-size: 11px;
    padding: 4px 8px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-radius: 12px;
    font-weight: 500;
  }
  
  .model-option:has(input:checked) {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
  }
  
  .model-option:has(input:checked) .model-name {
    color: var(--primary-dark);
  }
  
  /* Markdown styling for AI responses */
  .ai p {
    margin: 8px 0;
    line-height: 1.6;
  }
  
  .ai ul, .ai ol {
    margin-left: 20px;
    margin-top: 8px;
    margin-bottom: 8px;
  }
  
  .ai code {
    background-color: rgba(0, 0, 0, 0.04);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--primary-dark);
  }
  
  .ai pre {
    background-color: rgba(0, 0, 0, 0.04);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    margin: 12px 0;
  }
  
  .ai pre code {
    background-color: transparent;
    padding: 0;
    color: var(--text-primary);
  }
  
  /* Animations */
  @keyframes fadeIn {
    0% {
      opacity: 0;
      transform: translateY(10px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  @keyframes pulse {
    0% {
      transform: scale(0.95);
      opacity: 0.7;
    }
    50% {
      transform: scale(1);
      opacity: 1;
    }
    100% {
      transform: scale(0.95);
      opacity: 0.7;
    }
  }
  
  /* Loading animation for AI response */
  .typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
    margin-top: -2px;
  }
  
  .typing-dot {
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    opacity: 0.7;
  }
  
  .typing-dot:nth-child(1) {
    animation: pulse 1.2s infinite 0s;
  }
  
  .typing-dot:nth-child(2) {
    animation: pulse 1.2s infinite 0.4s;
  }
  
  .typing-dot:nth-child(3) {
    animation: pulse 1.2s infinite 0.8s;
  }
  
  /* Custom scrollbar */
  ::-webkit-scrollbar {
    width: 5px;
  }
  
  ::-webkit-scrollbar-track {
    background: transparent;
  }
  
  ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
  }
  
  /* Focus states for accessibility */
  button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
  
  .btn-send:focus-visible {
    outline: 2px solid white;
  }
  
  /* Night mode toggle effect */
  .night-mode-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .night-mode-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--background-color);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
  }
  
  .night-mode-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--primary-light);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-normal);
  }
  
  .night-mode-toggle:hover {
    color: var(--primary-color);
  }
  
  .night-mode-toggle:hover::after {
    opacity: 1;
    transform: scale(1);
  }
  
  .night-mode-toggle i {
    position: relative;
    z-index: 1;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  }
  
  .night-mode-toggle:hover i {
    transform: rotate(30deg);
  }
  
  /* Responsive adjustments */
  @media (max-width: 768px) {
    .app-container {
      width: 100%;
      height: 100vh;
      max-height: none;
      border-radius: 0;
    }
    
    .modal-content {
      width: 95%;
    }
  }
  
  /* Bottom sheet for mobile */
  .bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border-top-left-radius: var(--border-radius-lg);
    border-top-right-radius: var(--border-radius-lg);
    z-index: 100;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  }
  
  .bottom-sheet.show {
    transform: translateY(0);
  }
  
  .sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }
  
  .sheet-handle {
    width: 40px;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    margin: 0 auto 20px;
  }
  
  /* New message transition effect */
  .new-message-transition {
    transform: translateY(20px);
    opacity: 0;
    animation: slideUp 0.3s forwards;
  }
  
  @keyframes slideUp {
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  /* Copy button styling */
  .chat-message.ai {
    position: relative; /* Needed for absolute positioning of the copy button */
    padding-bottom: 30px; /* Add space for the button */
  }

  .copy-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px; /* Smaller size */
    height: 28px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.05); /* Subtle background */
    color: var(--text-secondary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    opacity: 0; /* Hidden by default */
    transform: scale(0.8);
  }

  .chat-message.ai:hover .copy-btn {
    opacity: 1; /* Show on hover */
    transform: scale(1);
  }

  .copy-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
  }

  .copy-btn:active {
    transform: scale(0.9);
  }

  .copy-btn i {
    font-size: 14px; /* Adjust icon size */
  }

  /* System message styling */
  .system-message {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    background-color: rgba(0, 0, 0, 0.03);
    padding: 8px 16px;
    border-radius: 12px;
    margin: 12px auto;
    max-width: 80%;
    transition: all 0.5s ease;
  }
  
  /* Send button active state */
  .btn-send.active {
    transform: rotate(-45deg) scale(1.05);
    background-color: var(--primary-dark);
    box-shadow: 0 3px 12px rgba(33, 150, 243, 0.5);
  }
  
  /* Button hover ripple effect */
  .ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
  }
  
  @keyframes ripple {
    to {
      transform: scale(2.5);
      opacity: 0;
    }
  }