/* AI Tools Shared Styles - Common Styles for All AI Tools */

/* ========== LAYOUT & CONTAINER ========== */
.ai-essay-writer-section,
.topic-generator-section {
  padding: 130px 0 80px;
  background: linear-gradient(180deg, #f8fcff 0%, #ffffff 100%);
  position: relative;
}

.essay-writer-wrapper,
.topic-generator-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 15px;
}

/* ========== HEADER STYLES ========== */
.essay-writer-header,
.topic-generator-header {
  text-align: center;
  margin-bottom: 40px;
}

.main-heading {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.gradient-text {
  background: linear-gradient(135deg, #117bd4 0%, #2d96ee 50%, #1176ca 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.subheading-text {
  color: #231f20;
  font-weight: 500;
}

.subtitle {
  color: #64748b;
  font-size: 16px;
  line-height: 1.6;
  max-width: 720px;
  margin: 0 auto;
  font-weight: 400;
}

/* ========== TRUST BADGES ========== */
.trust-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 32px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.badge-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #475569;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.2s ease;
}

.badge-item:hover {
  transform: translateY(-2px);
}

.badge-item svg {
  flex-shrink: 0;
}

.badge-item span {
  white-space: nowrap;
}

/* ========== FORM CARD ========== */
.essay-form-card,
.topic-form-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  padding: 40px;
  margin-bottom: 32px;
  border: 1px solid #f1f5f9;
}

.essay-writer-form,
.topic-generator-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ========== TEXTAREA GROUP ========== */
.textarea-group {
  position: relative;
  z-index: 1;
}

.essay-topic-input,
.subject-input {
  width: 100%;
  min-height: 160px;
  padding: 16px;
  padding-bottom: 48px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1e293b;
  resize: vertical;
  transition: all 0.3s ease;
  outline: none;
  line-height: 1.6;
}

.essay-topic-input::placeholder,
.subject-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.essay-topic-input:hover,
.subject-input:hover {
  border-color: #cbd5e1;
}

.essay-topic-input:focus,
.subject-input:focus {
  border-color: #1e293b;
  box-shadow: 0 0 0 3px rgba(35, 63, 140, 0.1);
}

.character-count {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
  pointer-events: none;
  z-index: 2;
}

.textarea-actions {
  position: absolute;
  bottom: 12px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.btn-paste,
.btn-history {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Hide history button by default - only show when history exists */
.btn-history {
  display: none;
}

.btn-history.has-history {
  display: inline-flex;
}

.btn-paste:hover,
.btn-history:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.btn-paste svg,
.btn-history svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ========== FORM CONTROLS ========== */
.form-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-group {
  flex: 1;
  min-width: 200px;
}

.select-group {
  position: relative;
}

.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  background: #ffffff;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select:hover {
  border-color: #cbd5e1;
}

.form-select:focus {
  border-color: #1e293b;
  box-shadow: 0 0 0 3px rgba(35, 63, 140, 0.1);
}

.form-select option {
  padding: 8px;
}

/* ========== ACTION ROW ========== */
.action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* ========== TOGGLE SWITCH ========== */
.toggle-group {
  flex: 0 0 auto;
  min-width: auto;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #475569;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  border-radius: 24px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-input:checked + .toggle-slider {
  background-color: #1e293b;
}

.toggle-input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-switch.small {
  width: 36px;
  height: 20px;
}

.toggle-switch.small .toggle-slider:before {
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
}

.toggle-switch.small .toggle-input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* ========== GENERATE BUTTON ========== */
.btn-generate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: #233f8c;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 4px 12px rgba(35, 63, 140, 0.25);
  flex-shrink: 0;
}

.btn-generate:hover {
  transform: translateY(-2px);
  background: #1f46b4;
  box-shadow: 0 6px 20px rgba(35, 63, 140, 0.35);
}

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

.btn-generate svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  margin-left: 2px;
}

.btn-generate:hover svg {
  transform: scale(1.15) rotate(12deg);
}

.btn-generate:disabled {
  background: #cbd5e1;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-generate:disabled:hover {
  transform: none;
}

/* ========== EDITORS BANNER ========== */
.editors-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  padding: 20px 32px;
  border-radius: 50px;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.15);
}

.editors-text {
  font-size: 15px;
  font-weight: 600;
  color: #075985;
  margin: 0;
  flex: 1;
}

.editors-avatars {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.editor-avatar {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50%;
  border: 2px solid #ffffff;
  object-fit: cover;
  margin-left: -8px;
  transition: transform 0.2s ease;
  display: block;
}

.editor-avatar:first-child {
  margin-left: 0;
}

.editor-avatar:hover {
  transform: scale(1.1);
  z-index: 1;
}

/* ========== RESULT VIEW STYLES ========== */

/* Result Wrapper */
.essay-result-wrapper,
.topic-result-wrapper {
  animation: fadeIn 0.3s ease-in-out;
  min-height: calc(100vh - 200px);
}

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

/* Result Header */
.result-header {
  margin-bottom: 32px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #475569;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  text-decoration: underline;
}

.btn-back:hover {
  background: #f8fafc;
  color: #1e293b;
}

.btn-back svg {
  width: 20px;
  height: 20px;
}

/* Result Content Layout */
.result-content {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 32px;
  align-items: start;
}

/* Left Sidebar */
.result-sidebar {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid #f1f5f9;
  position: sticky;
  top: 24px;
  height: fit-content;
  overflow-y: auto;
}

.result-topic-card,
.result-subject-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.topic-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  position: relative;
}

.topic-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
  line-height: 1.4;
  word-break: break-word;
}

.result-topic-input,
.result-subject-input {
  flex: 1;
  width: 100%;
  min-height: 80px;
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
  margin: 0;
  line-height: 1.6;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  resize: vertical;
  overflow-y: auto;
  max-height: 200px;
}

.result-topic-input::placeholder,
.result-subject-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}

.result-topic-input:focus,
.result-subject-input:focus {
  outline: none;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}

.btn-icon:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.btn-clear-topic svg,
.btn-clear-subject svg {
  width: 16px;
  height: 16px;
}

.topic-char-count,
.subject-char-count {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

/* Result Settings */
.result-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.setting-item {
  display: flex;
  align-items: center;
}

.setting-item.toggle-setting {
  justify-content: space-between;
}

.setting-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.result-select {
  width: 100%;
  padding: 8px 28px 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  color: #1e293b;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
}

.result-select:hover {
  border-color: #cbd5e1;
}

.result-select:focus {
  border-color: #1e293b;
  box-shadow: 0 0 0 3px rgba(35, 63, 140, 0.08);
}

.result-select option {
  padding: 8px;
  background: #ffffff;
  color: #1e293b;
}

/* Result Actions */
.result-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.btn-generate-again {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: #233f8c;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: 0 4px 12px rgba(35, 63, 140, 0.25);
  white-space: nowrap;
}

.btn-generate-again:hover {
  background: #1f46b4;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(35, 63, 140, 0.35);
}

.btn-generate-again svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
  margin-left: 2px;
}

.btn-generate-again:hover svg {
  transform: scale(1.15) rotate(12deg);
}

.btn-clear-settings {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'CircularStd', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: nowrap;
}

.btn-clear-settings:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

/* Previous Prompts */
.previous-prompts {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.previous-prompts h4 {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 12px 0;
}

.prompts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 156px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

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

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

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

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

.prompts-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.4;
}

.prompts-list li:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.prompts-list li svg {
  width: 14px;
  height: 14px;
  color: #94a3b8;
  flex-shrink: 0;
}

.prompts-list li .prompt-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

/* Result Disclaimer */
.result-disclaimer {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.result-disclaimer p {
  margin: 0;
}

/* Right Main Panel */
.result-main {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  border: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
}

/* Loading State */
.essay-loading,
.topics-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 20px;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e2e8f0;
  border-top-color: #1e293b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.essay-loading p,
.topics-loading p {
  font-size: 16px;
  color: #64748b;
  margin: 0;
  font-weight: 500;
}

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

/* Trust Badges Responsive */
@media (max-width: 768px) {
  .trust-badges {
    gap: 20px;
    margin-top: 24px;
  }

  .badge-item {
    font-size: 13px;
    gap: 6px;
  }

  .badge-item svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .trust-badges {
    gap: 16px;
  }

  .badge-item {
    flex: 0 0 calc(50% - 8px);
    justify-content: center;
  }
}

/* Form Responsive */
@media (max-width: 1024px) {
  .form-row {
    flex-wrap: wrap;
  }

  .form-group {
    min-width: calc(50% - 6px);
  }
}

@media (max-width: 768px) {
  .ai-essay-writer-section,
  .topic-generator-section {
    padding: 100px 0 80px;
  }

  .essay-writer-wrapper,
  .topic-generator-wrapper {
    padding: 0;
  }

  .main-heading {
    font-size: 36px;
  }

  .subtitle {
    font-size: 15px;
  }

  .essay-form-card,
  .topic-form-card {
    padding: 24px;
  }

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

  .form-group {
    width: 100%;
    min-width: 100%;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .toggle-label {
    justify-content: space-between;
  }

  .btn-generate {
    width: 100%;
    justify-content: center;
  }

  .editors-banner {
    flex-direction: column;
    gap: 16px;
    padding: 20px 24px;
    border-radius: 16px;
    text-align: center;
  }

  .editors-text {
    text-align: center;
  }

  .editors-avatars {
    justify-content: center;
  }
}

@media (max-width: 575px) {
  .main-heading {
    font-size: 28px;
  }

  .essay-form-card,
  .topic-form-card {
    padding: 20px;
    border-radius: 12px;
  }

  .essay-topic-input,
  .subject-input {
    min-height: 120px;
    padding: 12px;
    padding-bottom: 48px;
    font-size: 14px;
  }

  .textarea-actions {
    flex-direction: row;
    flex-wrap: wrap;
    bottom: 10px;
    left: 12px;
    right: 12px;
    gap: 6px;
  }

  .btn-paste,
  .btn-history {
    flex: 1;
    min-width: auto;
    justify-content: center;
  }

  .form-select {
    font-size: 13px;
    padding: 10px 36px 10px 12px;
  }

  .btn-generate {
    padding: 12px 24px;
    font-size: 14px;
  }

  .editors-banner {
    padding: 16px 20px;
  }

  .editors-text {
    font-size: 14px;
  }

  .editor-avatar {
    width: 36px;
    height: 36px;
  }
}

/* Result View Responsive */
@media (max-width: 1024px) {
  .result-content {
    grid-template-columns: 1fr;
  }

  .result-sidebar {
    position: static;
    order: 1;
  }

  .result-main {
    order: 2;
  }
}

@media (max-width: 768px) {
  .result-sidebar {
    padding: 20px;
  }
}

@media (max-width: 575px) {
  .btn-back {
    font-size: 14px;
    padding: 8px 16px;
  }
}
