/* === CSS VARIABLES === */
:root {
  --color-primary: #4CAF50;
  --color-primary-dark: #388E3C;
  --color-primary-deep: #2E7D32;
  --color-primary-light: #E8F5E9;
  --color-border: #E0E0E0;
  --color-bg: #fff;
  --color-bg-input: #F9F9F9;
  --color-text: #222;
  --color-text-light: #555;
  --color-placeholder: #BDBDBD;
  --color-disabled: #A5D6A7;
  --color-shadow: rgba(76, 175, 80, 0.08);
  --color-success: #4CAF50;
  --color-error: #f44336;
  --color-warning: #ff9800;
}

/* === GLOBAL RESETS === */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--color-text);
  background-color: var(--color-bg);
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 768px;
  margin: 0 auto;
  background-color: var(--color-bg);
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: var(--color-primary-light);
  border-bottom: 1px solid #C8E6C9;
}
.header__location {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--color-primary);
}

/* === FORMS === */
form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
input[type="tel"],
input[type="password"],
input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--color-text);
  background-color: var(--color-bg-input);
  transition: border-color 0.3s, box-shadow 0.3s;
  max-width: 320px;
}
input[type="tel"]::placeholder,
input[type="password"]::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder {
  color: var(--color-placeholder);
}
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="email"]:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
  outline: none;
  background-color: #fff;
}
label {
  align-self: flex-start;
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 4px;
  font-weight: 500;
  width: 100%;
  max-width: 320px;
}

/* === BUTTONS === */
.btn {
  width: 100%;
  max-width: 320px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  height: 40px;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  font-size: 0.98rem;
  height: 40px;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary-deep));
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.btn:disabled {
  background: var(--color-disabled);
  cursor: not-allowed;
  color: rgba(255,255,255,0.7);
  transform: none;
  box-shadow: none;
}

.btn:disabled::before {
  display: none;
}

.btn-link {
  background: none;
  color: var(--color-primary);
  text-decoration: none;
  padding: 0;
  font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

/* === RESULT CONTAINER === */
.result-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  width: 100%;
  margin: 0 auto 20px auto;
  padding: 24px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 16px var(--color-shadow);
  box-sizing: border-box;
  min-height: 100px;
}
.result-column .title {
  display: block;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 8px;
  font-size: 14px;
}
.result-column .text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text);
  overflow-wrap: break-word;
  word-break: break-word;
}
@media (max-width: 600px) {
  .result-container {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
  }
}

/* === DOWNLOAD BUTTON === */
.download-button {
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s, box-shadow 0.2s;
  width: 100%;
  max-width: 320px;
  height: 44px;
  box-sizing: border-box;
  margin: 16px auto;
  display: block;
  font-weight: bold;
}
.download-button:hover:not(:disabled) {
  background-color: var(--color-primary-dark);
}
.download-button:disabled {
  background-color: var(--color-disabled);
  cursor: not-allowed;
}

/* === UPLOAD OPTIONS === */
.upload-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
}
.upload-options__button {
  width: 100%;
  max-width: 340px;
  padding: 14px 0;
  border-radius: 12px;
  font-size: 1.08rem;
  font-weight: 600;
  background: var(--color-primary-light);
  color: var(--color-primary-deep);
  border: none;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s, transform 0.1s;
}
.upload-options__button:active {
  background: #C8E6C9;
  color: var(--color-primary-dark);
  transform: scale(0.98);
}
.upload-options__icon img {
  width: 32px;
  height: 32px;
}
@media (max-width: 600px) {
  .upload-options {
    gap: 12px;
    margin-top: 12px;
  }
  .upload-options__button {
    max-width: 98vw;
    font-size: 1rem;
    padding: 12px 0;
    border-radius: 10px;
    box-shadow: none;
  }
  .promo__slider img {
    max-width: 98vw;
    border-radius: 10px;
  }
}

/* === NAVIGATION BAR === */
.nav-bar {
  background-color: var(--color-primary-light);
  border-top: 1px solid #C8E6C9;
  padding: 4px 0 2px 0;
  position: fixed;
  bottom: 0;
  z-index: 1000;
  left: 0;
  right: 0;
  height: 54px;
}
.nav-bar__list {
  display: flex;
  width: 100%;
  justify-content: space-around;
  padding-left: 0;
  list-style-type: none;
}
.nav-bar__item {
  flex: 1;
  text-align: center;
}
.nav-bar__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
}
.nav-bar__icon img {
  width: 18px;
}

/* === PROMO IMAGES === */
.promo-images {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 18px;
}
.promo-images img {
  width: 100%;
  max-width: 340px;
  display: block;
  margin: 0 auto 18px auto;
  border-radius: 12px;
  object-fit: cover;
}

/* === TITLES === */
h1.page-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #333;
}
h2 {
  text-align: center;
  font-size: 24px;
  margin-bottom: 20px;
  color: #333;
}
.main-title {
  text-align: center;
  font-size: 1.2rem;
  margin-bottom: 18px;
  font-weight: 600;
}

/* === BOTTOM NAV (MOBILE) === */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  padding: 6px 0;
  z-index: 100;
}
.bottom-nav a {
  color: var(--color-primary-deep);
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bottom-nav img {
  width: 24px;
  margin-bottom: 2px;
}

/* === PASSWORD TOGGLE (EYE) === */
.password-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 320px;
}
.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
  padding-right: 38px;
}
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none !important;
  border: none !important;
  cursor: pointer;
  padding: 0 !important;
  margin: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  opacity: 0.6;
  transition: opacity 0.2s;
  box-shadow: none !important;
  z-index: 2;
}
.password-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
}
.password-toggle:hover {
  opacity: 1;
}

/* === UTILITY === */
.hide { display: none !important; }

/* === MOBILE FIRST AUTH FORM === */
.auth-toggle {
  margin-bottom: 24px;
  gap: 8px;
  padding: 0 4px;
}
.auth-toggle__btn {
  font-size: 0.98rem;
  padding: 8px 14px;
  min-width: 110px;
  border-radius: 8px;
  height: 38px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}
.auth-toggle__btn--active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  transform: translateY(-1px);
}
.auth-toggle__btn:not(.auth-toggle__btn--active) {
  background: var(--color-primary-light);
  color: var(--color-primary-deep);
  border: 2px solid var(--color-primary);
}
.auth-toggle__btn:not(.auth-toggle__btn--active):hover {
  background: var(--color-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

#multi-step-form {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 20px var(--color-shadow);
  padding: 24px 20px 20px 20px;
  margin-top: 16px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--color-border);
}
#multi-step-form label {
  font-size: 1rem;
  margin-bottom: 6px;
  color: var(--color-text-light);
  font-weight: 600;
  display: flex;
  align-items: center;
}
#multi-step-form input {
  font-size: 1rem;
  padding: 14px 16px;
  border-radius: 10px;
  max-width: 100%;
  border: 2px solid var(--color-border);
  transition: all 0.3s ease;
  background: var(--color-bg-input);
}
#multi-step-form input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
  background: #fff;
  transform: translateY(-1px);
}
#multi-step-form button.btn {
  font-size: 0.98rem;
  padding: 10px 0;
  border-radius: 8px;
  min-width: 110px;
  height: 38px;
  margin-top: 10px;
  font-weight: 600;
}

#forgot-password-link {
  font-size: 0.97rem;
  color: var(--color-primary);
  margin-top: 8px;
}

#message-div {
  font-size: 1rem;
  min-height: 24px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
}

#message-div.success {
  background: rgba(76, 175, 80, 0.1);
  color: var(--color-success);
  border: 1px solid rgba(76, 175, 80, 0.3);
}

#message-div.error {
  background: rgba(244, 67, 54, 0.1);
  color: var(--color-error);
  border: 1px solid rgba(244, 67, 54, 0.3);
  animation: shake 0.5s ease-in-out;
}

#message-div.info {
  background: rgba(33, 150, 243, 0.1);
  color: #2196F3;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 600px) {
  .app-wrapper {
    box-shadow: none;
    max-width: 100vw;
    border-radius: 0;
    padding: 0;
  }
  .main-content {
    padding: 0 6vw;
  }
  .promo-images img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
  }
  .progress-bar {
    max-width: 100%;
    padding: 0 10px;
    margin-bottom: 20px;
  }
  .progress-step__number {
    width: 36px;
    height: 36px;
    font-size: 13px;
  }
  .progress-step__label {
    font-size: 11px;
  }
  #multi-step-form {
    padding: 20px 16px 16px 16px;
    max-width: 100%;
    box-shadow: 0 2px 12px var(--color-shadow);
    border-radius: 12px;
  }
  .auth-toggle__btn {
    font-size: 0.95rem;
    min-width: 120px;
    height: 40px;
    padding: 10px 16px;
  }
  #multi-step-form button.btn {
    font-size: 1rem;
    min-width: 100px;
    height: 44px;
    padding: 12px 0;
  }
  #multi-step-form input {
    font-size: 1rem;
    padding: 12px 14px;
    border-radius: 8px;
  }
  .btn {
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: 8px;
  }
  #message-div {
    font-size: 0.95rem;
    padding: 10px 14px;
    margin-top: 12px;
  }
}

/* === SMALL MOBILE OPTIMIZATION === */
@media (max-width: 480px) {
  .main-content {
    padding: 0 4vw;
  }
  .auth-toggle__btn {
    min-width: 100px;
    font-size: 0.9rem;
    padding: 8px 12px;
  }
  #multi-step-form {
    padding: 16px 12px 12px 12px;
  }
  .progress-step__number {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .progress-step__label {
    font-size: 10px;
  }
}

/* === END === */

/* === HISTORY PAGE (АНАЛИЗЫ) === */
.analysis-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.analysis-list__item {
  padding: 0;
  margin: 0;
}
.analysis-card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 10px var(--color-shadow);
  padding: 14px 18px;
  gap: 18px;
  transition: box-shadow 0.2s;
  border: 1px solid var(--color-border);
}
.analysis-card--completed {
  border-left: 5px solid var(--color-primary);
}
.analysis-card--processing {
  border-left: 5px solid #FFD600;
}
.analysis-card__preview {
  width: 48px;
  height: 60px;
  object-fit: contain;
  border-radius: 6px;
  background: var(--color-primary-light);
  border: 1px solid #E0E0E0;
  margin-right: 10px;
}
.analysis-card__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.analysis-card__date {
  font-size: 0.98rem;
  color: var(--color-text-light);
  margin-bottom: 2px;
}
.analysis-card__action {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-primary);
  font-weight: 500;
  font-size: 1.04rem;
}
.analysis-card__arrow {
  font-size: 1.2em;
  color: var(--color-primary-dark);
}
.analysis-card-download-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 120px;
  gap: 8px;
}
.analysis-download-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.analysis-download-btn:hover:not(:disabled) {
  background: var(--color-primary-dark);
}
.analysis-status-processing {
  color: #FFD600;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.5px;
}
@media (max-width: 600px) {
  .analysis-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 8px;
  }
  .analysis-card__preview {
    width: 38px;
    height: 48px;
    margin-right: 0;
  }
  .analysis-card-download-area {
    min-width: 100px;
    align-items: stretch;
  }
}

/* === PROGRESS BAR === */
.progress-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto 24px auto;
  max-width: 340px;
  position: relative;
  padding: 0 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.progress-bar::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 30px;
  right: 30px;
  height: 2px;
  background: var(--color-border);
  z-index: 1;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  transition: all 0.3s ease;
  list-style: none;
  margin: 0;
  padding: 0;
}

.progress-step__number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--color-text-light);
  transition: all 0.3s ease;
  margin-bottom: 8px;
}

.progress-step__label {
  font-size: 12px;
  color: var(--color-text-light);
  font-weight: 500;
  text-align: center;
  transition: color 0.3s ease;
}

.progress-step--active .progress-step__number {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.progress-step--active .progress-step__label {
  color: var(--color-primary);
  font-weight: 600;
}

.progress-step--completed .progress-step__number {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.progress-step--completed .progress-step__label {
  color: var(--color-primary);
}

/* === INPUT ICONS === */
.input-icon {
  margin-right: 8px;
  color: var(--color-text-light);
  vertical-align: middle;
}

/* === FORGOT PASSWORD LINK === */
.forgot-password-link {
  width: auto;
  max-width: 220px;
  margin-left: auto;
  margin-right: auto;
  display: flex !important;
  justify-content: center;
}

.forgot-password-link:hover {
  background: var(--color-primary);
  color: #fff !important;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.forgot-password-icon {
  color: inherit;
  font-size: 1em;
}

@media (max-width: 600px) {
  .btn,
  .auth-toggle__btn {
    max-width: 96vw;
    min-width: 0;
  }
  .forgot-password-link {
    max-width: 90vw;
    font-size: 0.92rem;
  }
}