/*──────────────────────────────────────────────────────────────────────────────
  styles-app.css · UPDATED (2025-10-06)
──────────────────────────────────────────────────────────────────────────────*/

:root{
  --primary : #1e3355;
  --section : #e4e8f3;
  --marker  : #505d74;
  --text    : #222;
}

/*════════════════════════════════════════════════════════════════════════════
  Сброс и типографика
════════════════════════════════════════════════════════════════════════════*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 12px; /* 👈 небольшой отступ в WebView */
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background: #f5f7fa;
  color: var(--text);
  line-height: 1.5;
}

h1 {
  margin: 0 0 16px;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
}

/*════════════════════════════════════════════════════════════════════════════
  Контейнер
════════════════════════════════════════════════════════════════════════════*/
.container {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px 40px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

/*════════════════════════════════════════════════════════════════════════════
  Форма
════════════════════════════════════════════════════════════════════════════*/
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px; /* 👈 компактнее */
}
.form-group label {
  margin-bottom: 2px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 10px; /* 👈 меньше высота */
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
  resize: vertical;
  line-height: 1.4;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

::placeholder {
  color: #888;
  font-style: italic;
  opacity: 0.8;
}

/* двухколоночные ряды */
.form-row.two-col {
  display: flex;
  gap: 12px; /* 👈 чуть меньше */
}
.form-row.two-col .form-group {
  flex: 1;
}

/* одиночные textarea */
#responsibilities {
  min-height: 80px;
}
#details {
  min-height: 140px;
}

/*════════════════════════════════════════════════════════════════════════════
  Кнопки
════════════════════════════════════════════════════════════════════════════*/
button[type="submit"],
.copy-button {
  display: block;
  width: 100%;
  padding: 12px 24px; /* 👈 компактнее */
  margin: 16px auto 0;
  border: none;
  border-radius: 6px;
  background: #007bff;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s ease;
}

button[type="submit"]:hover,
.copy-button:hover {
  background: #0056b3;
}

.resume-output + .copy-button {
  margin-top: 20px;
}

/*════════════════════════════════════════════════════════════════════════════
  Индикатор загрузки
════════════════════════════════════════════════════════════════════════════*/
.loading-indicator {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .6);
  z-index: 1000;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 6px solid var(--primary);
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/*════════════════════════════════════════════════════════════════════════════
  Резюме-фрейм
════════════════════════════════════════════════════════════════════════════*/
.mobile-frame {
  max-width: 100%;
  margin-top: 8px;
  padding: 0 12px; /* 👈 добавлены боковые отступы */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  transform-origin: top left;
}

/*════════════════════════════════════════════════════════════════════════════
  Таблицы резюме
════════════════════════════════════════════════════════════════════════════*/
.resume-master {
  width: 100%;
  border-collapse: collapse;
}
.resume-master td { padding: 0; }

.cap-table {
  width: 100%;
  border-collapse: collapse;
}
.cap-table td {
  background: var(--primary);
  color: #fff;
  padding: 12px;
  line-height: 1!important;
}
.cap-name {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 2px;
}
.cap-title {
  margin: 4px 0 0;
  font-size: 14px;
  text-transform: uppercase;
  opacity: .85;
}
.cap-right {
  text-align: right;
  font-size: 12px;
  white-space: normal;
  word-wrap: break-word;
  word-break: break-all;
}

.resume-body { padding: 0 12px 24px; }
.resume-text { margin: 0; line-height: 1.55; }
.resume-text-indent { text-indent: 20px; }

.section-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 0;
}
.section-table td {
  background: var(--section);
  padding: 8px 12px;
  font-weight: 700;
  line-height: 1.2!important;
}

.resume-list {
  margin: 0 0 8px 16px;
  padding-left: 0;
  list-style-type: disc;
}
.resume-list li { margin-bottom: 4px; }
.resume-list li::marker { color: var(--marker); }

hr.resume-end {
  width: 140px;
  height: 1px;
  margin: 24px auto;
  border: none;
  background: repeating-linear-gradient(
    90deg,
    #aab3c3 0 20px,
    transparent 20px 40px
  );
}

/*════════════════════════════════════════════════════════════════════════════
  Палитры
════════════════════════════════════════════════════════════════════════════*/
.palettes {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0 0;
}
.palettes button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  cursor: pointer;
}
.palettes [data-theme="theme-navy"]   { background: #1e3355; }
.palettes [data-theme="theme-teal"]   { background: #047d7d; }
.palettes [data-theme="theme-wine"]   { background: #7c132c; }
.palettes [data-theme="theme-indigo"] { background: #2f3c7e; }
.palettes [data-theme="theme-sand"]   { background: #c2a46d; }

.theme-navy   { --primary: #1e3355; --section: #e4e8f3; }
.theme-teal   { --primary: #047d7d; --section: #d9f0f0; }
.theme-wine   { --primary: #7c132c; --section: #f3e4e8; }
.theme-indigo { --primary: #2f3c7e; --section: #dde0f7; }
.theme-sand   { --primary: #c2a46d; --section: #f5efdf; }

/*════════════════════════════════════════════════════════════════════════════
  Медиа
════════════════════════════════════════════════════════════════════════════*/
@media(max-width:600px) {
  .container {
    margin: 24px auto;
    padding: 0 16px 32px;
  }
  .cap-table td { padding: 16px; }
  .cap-name { font-size: 22px; }
  .resume-body { padding: 0 16px 24px; }
  .form-row.two-col { flex-direction: column; } /* 👈 одна под другой */
  button { font-size: 16px; }
}

@media (max-width:650px) {
  .container {
    padding: 0 12px 24px; /* 👈 не убираем отступы */
  }
  .resume-master,
  .cap-table {
    width: 96% !important;
    table-layout: auto !important;
    margin: 0 auto !important;
  }
  .resume-master colgroup,
  .cap-table colgroup {
    display: none;
  }
}
