/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary:        #4F46E5;
  --primary-hover:  #4338CA;
  --primary-light:  #EEF2FF;
  --success:        #22C55E;
  --success-light:  #F0FDF4;
  --error:          #EF4444;
  --error-light:    #FEF2F2;
  --text:           #1E1B4B;
  --text-muted:     #6B7280;
  --border:         #E5E7EB;
  --border-focus:   #6366F1;
  --bg:             #F5F5FF;
  --card-bg:        #FFFFFF;
  --radius:         14px;
  --radius-sm:      8px;
  --shadow:         0 8px 40px rgba(79, 70, 229, 0.12);
  --transition:     0.22s ease;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

/* ===== PAGE WRAPPER ===== */
.page-wrapper {
  width: 100%;
  max-width: 520px;
}

/* ===== CARD ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 40px 36px;
  border: 1px solid rgba(99, 102, 241, 0.08);
}

.card__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.card__subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ===== FORM GROUPS ===== */
.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}

.required {
  color: var(--error);
  margin-left: 2px;
}

/* ===== TEXT INPUT ===== */
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text);
  background: #FAFAFA;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  appearance: textfield;
  -moz-appearance: textfield;
}

.form-input::-webkit-outer-spin-button,
.form-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.form-input.is-invalid {
  border-color: var(--error);
  background: var(--error-light);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input.is-valid {
  border-color: var(--success);
  background: var(--success-light);
}

/* ===== ERROR TEXT ===== */
.form-error {
  display: block;
  font-size: 0.8rem;
  color: var(--error);
  margin-top: 5px;
  min-height: 18px;
  transition: opacity var(--transition);
}

/* ===== FILE DROP ===== */
.file-drop {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #FAFAFA;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  cursor: pointer;
  overflow: hidden;
}

.file-drop:hover,
.file-drop.drag-over {
  border-color: var(--border-focus);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.file-drop.is-invalid {
  border-color: var(--error);
  background: var(--error-light);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.file-drop.has-file {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-light);
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-drop__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  pointer-events: none;
  text-align: center;
}

.file-drop__icon {
  margin-bottom: 10px;
  opacity: 0.75;
}

.file-drop__text {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.file-drop__link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.file-drop__hint {
  font-size: 0.76rem;
  color: #9CA3AF;
  margin-top: 4px;
}

.file-drop__selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  pointer-events: none;
  z-index: 1;
  position: relative;
}

.file-drop__filename {
  font-size: 0.88rem;
  font-weight: 500;
  color: #15803D;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-drop__remove {
  pointer-events: all;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  z-index: 3;
}

.file-drop__remove:hover {
  color: var(--error);
  background: var(--error-light);
}

/* ===== SUBMIT BUTTON ===== */
.btn-submit {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
  margin-top: 8px;
}

.btn-submit:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.38);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== STATUS BLOCK ===== */
.status-block {
  margin-top: 4px;
}

/* ===== LOADER ===== */
.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 24px;
  text-align: center;
}

.loader-ring {
  display: inline-block;
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

.loader-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 52px;
  height: 52px;
  margin: 6px;
  border: 5px solid transparent;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loader-spin 1.1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-ring div:nth-child(1) { animation-delay: -0.45s; border-top-color: var(--primary); }
.loader-ring div:nth-child(2) { animation-delay: -0.3s;  border-top-color: #818CF8; }
.loader-ring div:nth-child(3) { animation-delay: -0.15s; border-top-color: #C7D2FE; }
.loader-ring div:nth-child(4) { animation-delay: 0s;     border-top-color: #E0E7FF; }

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

.loader-text {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text);
}

.loader-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.loader-status {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 10px;
  min-height: 1.4em;
  transition: opacity 0.3s ease;
  letter-spacing: 0.01em;
}

/* ===== STATUS ICON ===== */
.status-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.status-icon--success {
  background: var(--success);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.status-icon--error {
  background: var(--error);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
  animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  0%   { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== SUCCESS / ERROR BLOCKS ===== */
.status-success,
.status-error {
  padding: 32px 20px 28px;
  text-align: center;
}

.status-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.status-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  word-break: break-word;
}

/* ===== RESET BUTTON ===== */
.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-reset:hover {
  background: #E0E7FF;
  border-color: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 540px) {
  .card {
    padding: 28px 20px 24px;
  }
  .card__title {
    font-size: 1.15rem;
  }
}
