:root {
  --header-text-color: #485c6e;
  --color-grey-50: #f1f1f1;
  --color-grey-300: #a0a0a0;
  --color-grey-700: #505050;
}

body {
  font-family:
    "Satoshi",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

.active-passive-parent-container {
  background-color: var(--color-blue-500);
}

.main-content-wrapper {
  padding: 1.5rem;
}

.content-container {
  background-color: white;
  border: 1px solid var(--color-grey-50);
  box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.12);
  overflow: visible;
}

.header-title {
  font-size: clamp(1.5rem, 2vw + 1rem, 2rem);
  font-weight: 700;
  color: var(--header-text-color);
}

.header-desc {
  font-size: clamp(0.875rem, 1vw + 0.25rem, 1rem);
  font-weight: 400;
  color: var(--header-text-color);
}

.content-grid {
  display: flex;
  width: 100%;
  min-height: 500px;
  flex-direction: column;
}

.main-content {
  flex: 0 0 70%; /* 70% when both visible */
}

.separator {
  background-color: var(--color-grey-50);
  margin: auto;
  height: 95%;
  display: none;
  width: 0.15rem;
  margin: 0.5;
}

.input-section,
.output-section {
  width: 100%;
  padding: 0.5rem;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-grey-700);
  margin-bottom: 1rem;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */

.empty-state {
  min-height: 250px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 2rem 1rem;
  text-align: center;
  color: #bebebe;
}

/* ==========================================================================
   HISTORY SECTION
   ========================================================================== */

.history-section {
  flex: none;
  height: 600px;
  min-height: 100%;
}

#cards-container {
  max-height: 100px;
}

.container-fluid {
  height: 100%;
  overflow-y: auto;
}

.grammar-container {
  max-width: 100%;
  padding: 0 1px;
}

.grammar-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
}

.grammar-card:hover {
  background: #f1f3f5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.timestamp {
  color: #6c757d;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 15px;
}

.text-card {
  background: white;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  border: 1px solid #dee2e6;
  position: relative;
}

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

.card-label {
  font-weight: 600;
  color: #495057;
  font-size: 14px;
  margin-bottom: 8px;
}

.card-content {
  background: white;
  border-radius: 8px;

  color: #212529;
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  transition: all 0.3s ease;
}

.card-content.preview {
  background: white;
  border-radius: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 3em;
}

.card-content.expanded {
  display: block;
  max-height: none;
}

.fade-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, transparent, white);
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.fade-overlay.hidden {
  opacity: 0;
}

.expand-indicator {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #6c757d;
  font-size: 12px;
  transition: transform 0.3s ease;
}

.grammar-card.expanded .expand-indicator {
  transform: rotate(180deg);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.action-btns {
  height: 2.95rem;
  position: relative;
  z-index: 1;
  margin: 5px 0;
}

#upload-doc-btn {
  border: 1px solid var(--color-grey-50);
  box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.12);
  width: 2.25rem;
  height: auto;
  background-color: white;
  color: #485c6e;
  transition: all 0.2s ease;
  cursor: pointer;
  border-radius: 0.5rem; /* rounded-lg */
  padding: 0.5rem; /* p-2 */
}

/* Hide text on small screens */
#upload-doc-btn span {
  display: none;
}

.header-action-btns {
  display: flex;
  gap: 0.5rem;
  height: 2.25rem;
}

.btn-primary {
  background: var(--color-primary-light);
  border: none;
  color: white;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  flex: 1;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--color-primary-dark);
}

.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.btn-loading-spinner {
  border: 1px solid #f3f4f6;
  border-top: 1px solid var(--color-primary-light);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

/* ==========================================================================
   KEYFRAME ANIMATIONS
   ========================================================================== */

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

  100% {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn-secondary {
  border: 1px solid var(--color-grey-50);
  box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.12);
  width: 2.25rem;
  height: auto;
  background-color: white;
  color: #485c6e;
  transition: all 0.2s ease;
  cursor: pointer;
  border-radius: 0.375rem;
  /* optional: subtle rounding */
}

/* Hover state */
.btn-secondary:hover:not(:disabled) {
  background-color: #f9fafb;
  /* light gray */
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.15);
  border-color: #e5e7eb;
  /* slightly darker border on hover */
}

/* Disabled state */
.btn-secondary:disabled {
  background-color: #f5f5f5;
  color: #a1a1aa;
  border-color: #e5e5e5;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ==========================================================================
   QUICK EXAMPLES & SAMPLE PILLS
   ========================================================================== */

.long-bordered-btn {
  border: 1px solid #d1d5db;
  color: #6b7280;
  padding: 0.5rem 0.75rem;
  background-color: transparent;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: none;
  align-items: center;
  gap: 0.25rem;
}

.long-bordered-btn:hover {
  background-color: #f9fafb;
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.06);
  border-color: #e5e7eb;
}

/* ==========================================================================
   INPUT TEXTAREA LIMIT
   ========================================================================== */

.input-group-custom {
  position: relative;
}

#text-content-textarea {
  position: relative;
  max-height: 420px;
  background: transparent;
  scroll-margin-top: 190px;
  resize: none;
  z-index: 1;
}

#action-section {
  background: #fbfbfd; /* optional for readability */
}

.textarea-container {
  position: relative;
}

.instruction {
  position: relative;
  bottom: -2px;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  z-index: 2;
  border: 1px solid #dee2e6;
  border-top: 2px dashed #e5e7eb;
  background: #fbfbfd;
  text-align: center;
}

/* Remove Bootstrap focus border and shadow */
.form-control:focus {
  border-color: #ced4da !important;
  box-shadow: none !important;
  outline: none !important;
}

.instruction-steps-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  /* position: relative; */
  margin: 1.5rem;
  align-items: stretch; /* makes children equal height */
}

.i-step-arrow-1 {
  position: absolute;
  bottom: -63px;
  left: -25px;
  transform: rotateZ(45deg) rotateX(90deg);
}

.i-step-arrow-2 {
  position: absolute;
  bottom: -63px;
  left: -25px;
  transform: rotate(90deg);
}

.form-control {
  border-bottom-left-radius: 0; /* square bottom-left */
  border-bottom-right-radius: 0; /* square bottom-right */
}

.instruction-title {
  font-size: 1.3rem;
  font-weight: 600;
}

.instruction-step-item {
  display: flex;
  align-items: start;
  gap: 0.75rem;
  position: relative;
  /* transition: background 0.2s ease, transform 0.2s ease; */
}

.instruction-step-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(230deg, #229dd6, #265baa);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem; /* default */
  border-bottom-left-radius: 0; /* remove left bottom rounding */
  flex-shrink: 0;
}

.i-step-title {
  font-size: 16px;
  font-weight: 500;
  text-align: left;
}

.i-step-desc {
  font-size: 0.9rem;
  font-weight: 400;
  text-align: left;
  color: #6b7280;
}

.instruction-header {
  padding-top: 6px;
}

.backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  overflow: hidden;
  padding: 0.375rem 0.75rem;
}

.highlights {
  white-space: pre-wrap;
  word-wrap: break-word;
  color: transparent;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  position: relative;
  bottom: 0px;
}

.highlights mark {
  background-color: #cdedff;
  border: 1px solid #a7e6ff;
  color: transparent;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.highlights mark::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-20deg);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    left: -150%;
  }
  100% {
    left: 150%;
  }
}

.char-counter {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 12px;
  color: #6b7280;
  background: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.char-limit-warning {
  color: #f59e0b;
}

.char-limit-error {
  color: #ef4444;
}

.form-label {
  font-size: 14px;
  font-weight: 700;
  color: #000000;
  margin-bottom: 0.4rem;
}

/* Show '*' mark in red for required labels */
.form-label.required::after {
  content: " *";
  color: red;
  font-weight: 700;
}

/* Show (Optional) in gray for optional labels */
.form-label.optional::after {
  content: " (Optional)";
  font-weight: 400;
  color: #a0a0a0;
}

/* Email Components */
/* Email Components Styles */
.email-components {
  margin-bottom: 1rem;
}

.email-type-section {
  margin-bottom: 16px;
}

.email-type-label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
  display: block;
}

.email-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.email-type-tab {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  background-color: #f9fafb;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.email-type-tab:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.email-type-tab.active {
  background-color: var(--color-primary-light);
  color: white;
}

.email-fields {
  display: grid;
  gap: 0.8rem;
}

.field-group {
  display: flex;
  flex-direction: column;
}

.field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-grey-700);
  margin-bottom: 6px;
}

.field-label .optional {
  font-weight: 400;
  color: var(--color-grey-300);
}

.field-input {
  padding: 10px 12px;
  max-height: 2.315rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  color: #374151;
  background-color: #ffffff;
  transition: border-color 0.2s ease;
}

.send-recipient-grid {
  display: grid;
  /* grid-template-columns: 1fr 1fr; */
  gap: 0.8rem;
}

.subject-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}

/* ==========================================================================
   RESULT SECTIONS
   ========================================================================== */

.converted-output {
  height: 100%;
  background-color: #f9f9f9;
  /* background-color: #f9f9f9; */
  /* border-radius: 0.75rem; */
  /* border: 1px solid #e0e0e0; */
  padding: 1rem;
  /* color: #374151; */
  /* box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); */
  transition: all 0.2s ease;
  /* word-break: break-word; */
}
#result-story-text {
  background-color: white;
  border-radius: 0.75rem;
  border: 1px solid #e0e0e0;
  padding: 1rem;
  color: #374151;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  word-break: break-word;
}

/* For Firefox */
#results-container {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* ==========================================================================
   VOICE TYPE RADIO BTNS
   ========================================================================== */

.input-action-btns-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  justify-content: space-between;
  margin: 0.8rem 0;
}

.input-action-btns {
  display: flex;
  flex-direction: column;
  align-items: start;
  justify-content: space-between;
  gap: 0.2rem;
}

.voice-type-container {
  display: flex;
  gap: 0.4rem;
  height: 100%;
  justify-content: start;
}

.voice-type-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.voice-type-option:hover {
  background: #f8fafc;
}

.voice-type-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary-light);
}

.voice-type-option label {
  font-size: 14px;
  font-weight: 400;
  color: #2f2f2f;
  cursor: pointer;
  margin: 0;
}

.story-configuration-dropdowns-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 0.7rem;
  width: 100%;
}

.story-advanced-dropdowns-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  width: 100%;
  overflow: visible;
}

#toggle-advanced-options {
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  color: #6b7280;
}
#toggle-advanced-options:hover {
  background-color: #f9fafb;
  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.03);
  border-color: #e5e7eb;
}

/* ==========================================================================
    RESPONSIVE DESIGN - BREAKPOINTS
    @media (max-width: 479px) {}
    @media (min-width: 480px) {}
    @media (min-width: 768px) {}
    @media (min-width: 1024px) {}
    @media (min-width: 1280px) {}
   ========================================================================== */

/* Small Mobiles */
@media (max-width: 479px) {
  /* smallest mobile devices */
}

@media (max-width: 767px) {
}

/* Mobile Only */
@media (min-width: 480px) {
  /* All mobile devices */
}

/* Tablet and Up */
@media (min-width: 768px) {
  .instruction-title {
    font-size: 1.64rem;
  }
}

/* Desktop and Up */
@media (min-width: 1024px) {
  /* Desktop and larger */

  .content-grid {
    flex-direction: row; /* side-by-side for large screens */
  }

  #text-content-textarea {
    min-height: 420px;
  }

  .instruction {
    position: absolute;
  }

  .instruction-steps-container {
    grid-template-columns: 1fr 1fr 1fr;
  }

  #upload-doc-btn {
    border: none;
    box-shadow: none;
    width: auto;
    background-color: transparent;
    color: inherit;
    border-radius: 0; /* remove rounding */
    padding: 0; /* remove padding */
  }

  #upload-doc-btn span {
    display: inline;
  }

  .input-action-btns-container {
    flex-direction: row;
  }

  .long-bordered-btn {
    display: flex;
  }

  .history-section {
    flex: 0 0 30%; /* 30% when visible */
    height: auto;
    min-height: 100%;
  }
}

@media (max-width: 768px) and (min-height: 1024px) {
  /* Target tablet portrait */
}

/* Large Desktop and Up */
@media (min-width: 1280px) {
  /* Large desktop and larger */
}

/* =======================
   ORIENTATION BREAKPOINTS
   ======================= */

/* Portrait orientation */
@media (orientation: portrait) {
  /* Portrait mode styles */
}

/* Landscape orientation */
@media (orientation: landscape) {
  /* Landscape mode styles */
}

/* Mobile landscape specifically */
@media (max-width: 767px) and (orientation: landscape) {
  /* Mobile in landscape */
}

/* Initial state: collapsed */
.collapse-transition {
  max-height: 0;
  /* overflow: hidden; */
  transition: max-height 0.4s ease-in-out;
}

/* Expanded state */
.collapse-transition.open {
  max-height: 500px; /* Adjust based on actual content height */
}

.highlight-sentence {
  background-color: #fff3cd;
  border-left: 3px solid #ffc107;
  padding: 2px 4px;
  margin: 2px 0;
  border-radius: 3px;
  animation: highlight-pulse 0.3s ease-in-out;
}

@keyframes highlight-pulse {
  0% {
    background-color: #fff3cd;
  }
  50% {
    background-color: #ffeaa7;
  }
  100% {
    background-color: #fff3cd;
  }
}

/* ==========================================================================
   TOGGLE SWITCH
   ========================================================================== */
.toggle-switch {
  display: inline-block;
  position: relative;
}

/* Hide default checkbox */
.toggle-input {
  display: none;
}

/* Track */
.toggle-label {
  display: inline-block;
  width: 40px; /* fixed so it doesn't shrink */
  height: 20px; /* fixed so circle stays aligned */
  background-color: #ccc;
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

/* Circle */
.toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px; /* smaller than track height */
  height: 16px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

/* Checked state */
.toggle-input:checked + .toggle-label {
  background-color: var(--color-primary-light); /* active blue */
}

.toggle-input:checked + .toggle-label .toggle-slider {
  transform: translateX(20px); /* exactly track width - circle width */
}

/* Modal Styles : ToDo: Place the modal style in global css as it will be a reusable component*/

/* For toast msg */
#messageBox {
  position: absolute;
  top: 10%;
  right: 1%;
  z-index: 9999;
  max-width: 40%;
  width: auto;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
