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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #ffffff;
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

html, body {
  height: 100%;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid #e9ecef;
}

header {
  background: #ffffff;
  color: #333;
  padding: 30px;
  text-align: center;
  position: relative;
  border-bottom: 2px solid #e9ecef;
}

.header-logo {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-img {
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
}

header h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin-bottom: 10px;
  color: #64bbe0;
}

header .btn {
  position: absolute;
  top: 20px;
  left: 20px;
  display: inline-flex;
  align-items: center;
}

header p {
  color: #666;
  font-size: 1.1rem;
}

main {
  padding: 40px;
}

.upload-section {
  max-width: 600px;
  margin: 0 auto;
}

.upload-area {
  border: 2px dashed #64bbe0;
  border-radius: 8px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #ffffff;
}

.upload-area:hover {
  border-color: #f5a04c;
  background: #ffffff;
  transform: translateY(-2px);
}

.upload-area.dragover {
  border-color: #f5a04c;
  background: #ffffff;
}

.upload-content svg {
  color: #64bbe0;
  margin-bottom: 20px;
}

.file-info {
  margin-top: 10px;
  color: #666;
  font-size: 0.9rem;
}

.actions {
  margin-top: 30px;
  text-align: center;
}

.btn {
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: #64bbe0;
  color: white;
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background: #4fa8d0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(100, 187, 224, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f5a04c;
  color: white;
  border: none;
}

.btn-secondary:hover {
  background: #e8903a;
}

/* Recorder Section */
.recorder-section {
  background: #ffffff;
  border-radius: 8px;
  padding: 30px;
  margin-bottom: 30px;
  border: 2px solid #e9ecef;
}

.recorder-section h2 {
  color: #64bbe0;
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.5rem;
}

.recorder-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-record {
  background: #64bbe0;
  color: white;
  padding: 15px 30px;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-record:hover:not(:disabled) {
  background: #4fa8d0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(100, 187, 224, 0.3);
}

.btn-record:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-stop {
  background: #f5a04c;
  color: white;
  padding: 15px 30px;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-stop:hover:not(:disabled) {
  background: #e8903a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(245, 160, 76, 0.3);
}

.btn-stop:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.record-icon,
.stop-icon {
  display: inline-block;
  vertical-align: middle;
}

/* Lucide Icons Styles */
.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.icon-small {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 5px;
}

.icon-large {
  width: 64px;
  height: 64px;
  display: block;
  margin: 0 auto 20px;
  color: #64bbe0;
}

.icon-action {
  width: 18px;
  height: 18px;
  display: inline-block;
}

/* Process Section */
.process-section {
  margin-top: 20px;
  text-align: center;
  display: block !important;
}

.process-section .btn {
  width: 100%;
  max-width: 300px;
  padding: 15px 30px;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Audio Section */
.audio-section {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
}

.audio-section h3 {
  color: #64bbe0;
  margin-bottom: 15px;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-section audio {
  border-radius: 4px;
}

.recording-status {
  margin-top: 20px;
  text-align: center;
}

.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 10px 20px;
  border-radius: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.pulse {
  width: 12px;
  height: 12px;
  background: #f5a04c;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

#recordingTime {
  font-weight: 600;
  color: #f5a04c;
  font-size: 1.1rem;
}

.divider {
  text-align: center;
  margin: 30px 0;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: #e9ecef;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.divider span {
  background: white;
  padding: 0 15px;
  color: #666;
  font-weight: 600;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.loader-container {
  background: white;
  border-radius: 8px;
  padding: 40px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #e9ecef;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #64bbe0;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-container h3 {
  color: #64bbe0;
  margin-bottom: 10px;
  font-size: 1.5rem;
}

.loader-container p {
  color: #666;
  margin-bottom: 20px;
}

.loader-container .progress-bar {
  width: 100%;
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

.loader-container .progress-fill {
  height: 100%;
  background: #64bbe0;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  color: #64bbe0;
  font-weight: 600;
  font-size: 0.9rem;
}

.progress-section {
  margin-top: 30px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: #64bbe0;
  width: 0%;
  transition: width 0.3s ease;
}

.error-message {
  background: #fff5f5;
  color: #c33;
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
  border-left: 4px solid #f5a04c;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #666;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.medical-history {
  margin-top: 20px;
}

.history-content {
  background: #ffffff;
  padding: 30px;
  border-radius: 8px;
  line-height: 1.8;
  color: #333;
  border: 1px solid #e9ecef;
}

.history-content h1 {
  color: #64bbe0;
  margin-top: 30px;
  margin-bottom: 20px;
  font-size: 2rem;
  border-bottom: 3px solid #64bbe0;
  padding-bottom: 10px;
}

.history-content h2 {
  color: #64bbe0;
  margin-top: 25px;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 2px solid #e0f4ff;
  padding-bottom: 8px;
}

.history-content h3 {
  color: #f5a04c;
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.history-content h4 {
  color: #f5a04c;
  margin-top: 15px;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.history-content p {
  margin-bottom: 15px;
  text-align: justify;
}

.history-content ul,
.history-content ol {
  margin-left: 30px;
  margin-bottom: 15px;
}

.history-content li {
  margin-bottom: 8px;
}

.history-content strong {
  color: #333;
  font-weight: 600;
}

.history-content em {
  color: #666;
  font-style: italic;
}

.history-content code {
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #f5a04c;
}

.history-content pre {
  background: #2d2d2d;
  color: #f8f8f2;
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 15px;
}

.history-content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.history-content blockquote {
  border-left: 4px solid #64bbe0;
  padding-left: 20px;
  margin-left: 0;
  margin-bottom: 15px;
  color: #666;
  font-style: italic;
}

.history-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.history-content table th,
.history-content table td {
  border: 1px solid #e9ecef;
  padding: 10px;
  text-align: left;
}

.history-content table th {
  background: #64bbe0;
  color: white;
  font-weight: 600;
}

.history-content table tr:nth-child(even) {
  background: #ffffff;
}

.history-content hr {
  border: none;
  border-top: 2px solid #e9ecef;
  margin: 30px 0;
}

.items-list {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.item-card {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s ease;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-color: #64bbe0;
}

.item-card h3 {
  color: #64bbe0;
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.item-card .item-field {
  margin-bottom: 8px;
}

.item-card .item-field strong {
  color: #333;
  margin-right: 8px;
}

.item-card .item-value {
  color: #666;
}

footer {
  background: #ffffff;
  padding: 20px;
  text-align: center;
  border-top: 1px solid #e9ecef;
}

footer nav {
  display: flex;
  gap: 20px;
  justify-content: center;
}

footer nav a {
  color: #64bbe0;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

footer nav a:hover {
  color: #f5a04c;
}

/* CRUD Styles */
.crud-header {
  margin-bottom: 30px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-message {
  text-align: center;
  color: #666;
  padding: 40px;
  font-size: 1.1rem;
}

/* Transcriptions List */
.transcriptions-list {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.transcription-card {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.3s ease;
}

.transcription-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-color: #64bbe0;
}

.transcription-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}

.transcription-header h3 {
  color: #64bbe0;
  margin: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.transcription-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-item {
  display: flex;
  gap: 10px;
}

.info-item strong {
  color: #333;
  min-width: 120px;
}

.info-item span {
  color: #666;
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}

.item-actions {
  display: flex;
  gap: 10px;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.btn-edit {
  color: #64bbe0;
}

.btn-edit:hover {
  background: #e0f4ff;
  color: #4fa8d0;
}

.btn-delete {
  color: #f5a04c;
}

.btn-delete:hover {
  background: #fff5e6;
  color: #e8903a;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: #ffffff;
  margin: auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border: 1px solid #e9ecef;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid #e9ecef;
  background: #64bbe0;
  color: white;
  border-radius: 8px 8px 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: white;
}

.modal-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.modal form {
  padding: 30px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #333;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #64bbe0;
  box-shadow: 0 0 0 3px rgba(100, 187, 224, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.success-message {
  background: #d4edda;
  color: #155724;
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
  margin-bottom: 20px;
  border-left: 4px solid #28a745;
}

/* WYSIWYG Editor Styles */
.wysiwyg-editor-container {
  margin-bottom: 20px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
}

.wysiwyg-editor-container .toastui-editor-defaultUI {
  border: none;
}

.wysiwyg-editor-container .toastui-editor-defaultUI-toolbar {
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.wysiwyg-editor-container .toastui-editor-contents {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 1rem;
  line-height: 1.8;
  color: #333;
}

.wysiwyg-editor-container .toastui-editor-contents h1 {
  color: #64bbe0;
  margin-top: 30px;
  margin-bottom: 20px;
  font-size: 2rem;
  border-bottom: 3px solid #64bbe0;
  padding-bottom: 10px;
}

.wysiwyg-editor-container .toastui-editor-contents h2 {
  color: #64bbe0;
  margin-top: 25px;
  margin-bottom: 15px;
  font-size: 1.5rem;
  border-bottom: 2px solid #e0f4ff;
  padding-bottom: 8px;
}

.wysiwyg-editor-container .toastui-editor-contents h3 {
  color: #f5a04c;
  margin-top: 20px;
  margin-bottom: 12px;
  font-size: 1.2rem;
}

.wysiwyg-editor-container .toastui-editor-contents h4 {
  color: #f5a04c;
  margin-top: 15px;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .container {
    margin: 10px;
    border-radius: 8px;
  }

  header {
    padding: 20px;
  }

  .logo-img {
    max-height: 60px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  main {
    padding: 20px;
  }

  .upload-area {
    padding: 40px 20px;
  }

  .modal-content {
    width: 95%;
    margin: 10px;
  }

  .modal-header {
    padding: 15px 20px;
  }

  .modal form {
    padding: 20px;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .transcription-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .transcription-header .btn {
    width: 100%;
  }

  .info-item {
    flex-direction: column;
    gap: 5px;
  }

  .info-item strong {
    min-width: auto;
  }
}