/* insur_tale Babelfish - Production-Ready Design System */

/* Import insur_tale Typography */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800&family=IBM+Plex+Sans:wght@400;600;700&display=swap');

/* insur_tale Design System Variables */
:root {
  --font-family: 'Barlow Condensed', 'IBM Plex Sans', sans-serif;

  /* insur_tale Primary Blue */
  --primary-color: #1e5aa8;
  --primary-light: #5a88c7;
  --primary-dark: #19406e;
  --primary-bg: rgba(30, 90, 168, 0.1);
  --primary-bg-dark: rgba(30, 90, 168, 0.3);

  /* insur_tale Secondary Red */
  --secondary-color: #e82a1f;
  --secondary-light: #ec5c4f;
  --secondary-dark: #8c1c13;

  /* insur_tale Success Green */
  --tertiary-color: #276738;
  --tertiary-light: #4a8a5e;
  --tertiary-dark: #1e4f2a;

  /* insur_tale Neutral Colors */
  --bg-color: #f0f2f5;
  --white: #fefefe;
  --black: #1f2937;
  --black-light: #4b5563;
  --inactive-color: #8c8f94;

  /* Shadows */
  --card-shadow: 0 10px 15px -3px #0000001a, 0 4px 6px -2px #0000000d;
  --card-shadow-hover: 0 20px 25px -5px #0000001a, 0 10px 10px -5px #0000000d;
}

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

body {
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg-color);
  color: var(--black);
  line-height: 1.6;
}

/* Layout System - insur_tale Container */
.main-container {
  max-width: 1200px;
  width: 60vw;
  margin: 1.5rem auto 1.5rem auto;
  padding: 1rem;
  background: var(--white);
  box-shadow: var(--card-shadow);
  min-height: 80vh;
}

@media (max-width: 768px) {
  .main-container {
    width: 95vw;
    margin: 1rem auto;
    padding: 1rem;
  }
}

/* Header System */
.header {
  background: var(--bg-color);
  padding: 0;
}

.header-container {
  width: 60vw;
  max-width: 1200px;
  margin: 1rem auto 1.5rem auto;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--white);
  box-shadow: var(--card-shadow);
}

.header-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--black);
  font-family: 'Barlow Condensed', sans-serif;
}

.header-logo {
  width: 10rem;
  height: auto;
  margin-right: 1.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.username {
  font-size: 0.875rem;
  color: var(--black);
  font-family: 'IBM Plex Sans', sans-serif;
}

.logout-button {
  background: var(--secondary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: 'IBM Plex Sans', sans-serif;
}

.logout-button:hover {
  background: var(--secondary-light);
  transform: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p, span, div {
  font-family: 'IBM Plex Sans', sans-serif;
}

/* Content Areas */
.content-section {
  text-align: center;
  padding: 1rem 0 0 0;
}

.subtitle {
  margin: 0 0 2rem 0;
  font-size: 1.875rem;
  font-weight: 600;
  color: var(--black);
  font-family: 'Barlow Condensed', sans-serif;
}

/* Button System */
.btn {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--primary-light);
  color: white;
}

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

.btn-secondary:hover {
  background: var(--secondary-light);
  color: white;
}

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

.btn-success:hover {
  background: var(--tertiary-light);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.btn-outline:hover {
  background: var(--primary-color);
  color: white;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Form Controls */
.form-control {
  font-family: 'IBM Plex Sans', sans-serif;
  padding: 0.75rem 1rem;
  border: 2px solid var(--inactive-color);
  background: var(--white);
  color: var(--black);
  transition: border-color 0.2s ease;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem var(--primary-bg);
}

.form-label {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 0.5rem;
  display: block;
}

/* Card System */
.card {
  background: var(--white);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease;
}

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

.card-header {
  background: var(--primary-color);
  color: white;
  padding: 1rem 1.5rem;
  margin: -1.5rem -1.5rem 1.5rem -1.5rem;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 1.125rem;
}

/* Alert System */
.alert {
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  border: none;
  font-family: 'IBM Plex Sans', sans-serif;
}

.alert-info {
  background: var(--primary-bg);
  color: var(--primary-dark);
  border-left: 4px solid var(--primary-color);
}

.alert-success {
  background: rgba(39, 103, 56, 0.1);
  color: var(--tertiary-dark);
  border-left: 4px solid var(--tertiary-color);
}

.alert-danger {
  background: rgba(232, 42, 31, 0.1);
  color: var(--secondary-dark);
  border-left: 4px solid var(--secondary-color);
}

.alert-warning {
  background: rgba(255, 193, 7, 0.1);
  color: #856404;
  border-left: 4px solid #ffc107;
}

/* Progress System */
.progress {
  background: rgba(0, 0, 0, 0.1);
  height: 0.75rem;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar {
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  height: 100%;
  transition: width 0.6s ease;
}

/* Two-Column Layout for Upload/Recording */
.upload-recording-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

@media (max-width: 768px) {
  .upload-recording-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--primary-color);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--white);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.upload-area:hover {
  border-color: var(--primary-dark);
  background: var(--primary-bg);
  transform: translateY(-2px);
}

.upload-area.dragover {
  border-color: var(--tertiary-color);
  background: rgba(39, 103, 56, 0.1);
  transform: scale(1.02);
}

/* Recording Area */
.recording-area {
  padding: 2rem 1rem;
  background: var(--white);
  border: 2px solid var(--inactive-color);
  transition: all 0.3s ease;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
}

.recording-area > * {
  margin: 0;
}

.recording-status {
  margin-top: 0.5rem;;
}

.recording-area > *:not(:last-child) {
  margin-bottom: 1rem;
}

.recording-area.recording {
  background: rgba(232, 42, 31, 0.05);
  border-color: var(--secondary-color);
  box-shadow: 0 0 20px rgba(232, 42, 31, 0.2);
}

.recording-area.paused {
  background: rgba(255, 193, 7, 0.05);
  border-color: #ffc107;
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.2);
}

/* Recording Controls */
.recording-controls {
  margin: 1rem 0;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.recording-controls .btn {
  min-width: 150px;
}

/* Recording Status */
.recording-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: var(--secondary-color);
  animation: pulse 1.5s ease-in-out infinite;
  margin-right: 0.5rem;
}

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

.recording-timer {
  font-family: 'Courier New', monospace;
  color: var(--secondary-color);
  font-size: 1.5rem;
  font-weight: bold;
  margin: 1rem 0;
}

/* Purpose Badge System */
.purpose-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
  justify-content: center;
}

.purpose-badge {
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'IBM Plex Sans', sans-serif;
  background: var(--white);
  color: var(--black);
  border: 2px solid var(--inactive-color);
  box-shadow: var(--card-shadow);
}

.purpose-badge:hover {
  transform: translateY(-2px);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.purpose-badge.selected {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* User Story Accordion */
.user-story-accordion {
  margin: 1rem 0;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-story-accordion.d-none {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.user-story-accordion:not(.d-none) {
  max-height: 500px;
  opacity: 1;
}

.user-story-format {
  height: 100px;
  border: 2px solid var(--inactive-color);
  background: var(--white);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  cursor: pointer;
  padding: 1rem;
}

.user-story-format:hover {
  border-color: var(--primary-color);
  background: var(--primary-bg);
  transform: translateY(-3px);
  box-shadow: var(--card-shadow);
}

.user-story-format strong {
  color: var(--primary-color);
  font-size: 1rem;
  margin-bottom: 0.25rem;
  font-family: 'Barlow Condensed', sans-serif;
}

.user-story-format small {
  font-size: 0.75rem;
  color: var(--black-light);
  font-family: 'IBM Plex Sans', sans-serif;
}

/* Audio Preview */
.audio-preview-card {
  box-shadow: var(--card-shadow);
  margin: 0 0;
}

.audio-preview-info {
  background: var(--primary-bg);
  padding: 1rem;
  border-left: 4px solid var(--primary-color);
}

.audio-player-container {
  background: var(--white);
  border: 2px solid var(--inactive-color);
  padding: 1rem;
  transition: all 0.3s ease;
}

.audio-player-container:hover {
  border-color: var(--primary-color);
}

/* Audio Level Meters */
.audio-level-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
  gap: 0.5rem;
}

.audio-level-bars {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 40px;
  padding: 0 1rem;
}

.audio-level-bar {
  width: 4px;
  background: linear-gradient(to top, var(--tertiary-color), #ffc107, var(--secondary-color));
  transition: height 0.1s ease;
  min-height: 2px;
  height: 2px;
}

.audio-level-text {
  font-size: 0.9rem;
  color: var(--black-light);
  min-width: 80px;
  text-align: center;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* Copy Interface */
.copy-section {
  background: var(--primary-bg);
  border: 2px solid var(--primary-color);
  padding: 1rem;
  margin: 1rem 0;
}

.copy-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: 'IBM Plex Sans', sans-serif;
}

.copy-button:hover {
  background: var(--primary-light);
}

.copy-button.copied {
  background: var(--tertiary-color);
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--inactive-color);
  border-top: 3px solid var(--primary-color);
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

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

/* Animations */
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.4s ease-out;
}

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

/* Flash Messages */
.flash-message {
  animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash-close-btn:hover {
  opacity: 1 !important;
  transform: scale(1.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .header-container {
    width: 95vw;
    margin: 1rem auto;
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .header-logo {
    width: 8rem;
  }

  .subtitle {
    font-size: 1.5rem;
  }

  .purpose-badges {
    justify-content: center;
  }

  .recording-controls {
    flex-direction: column;
    align-items: center;
  }

  .recording-controls .btn {
    min-width: 200px;
  }

  /* Flash messages mobile */
  #flashMessagesContainer {
    width: 95vw !important;
    margin: 0.5rem auto !important;
    padding: 0 0.5rem !important;
  }
}

/* Focus States */
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem var(--primary-bg);
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* insur_tale Production Ready - Clean, Professional, Sharp */