/* ========== CSS Variables ========== */
:root {
  --primary: #1a6fba;
  --primary-dark: #145a9e;
  --primary-light: #e8f1fb;
  --accent: #f5a623;
  --success: #22c55e;
  --danger: #ef4444;
  --text-main: #1a1a2e;
  --text-sub: #5a6478;
  --text-hint: #9ca3af;
  --bg: #f0f4f8;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(26, 111, 186, 0.10);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  color: var(--text-main);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

input,
textarea,
button,
select {
  font-family: inherit;
  font-size: inherit;
}

/* ========== Container ========== */
.container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ========== Header / Nav ========== */
.header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(26, 111, 186, 0.2);
}

.header-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  margin-right: 10px;
  flex-shrink: 0;
  transition: background 0.2s;
}

.header-back:active {
  background: rgba(255, 255, 255, 0.25);
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ========== Hero Section ========== */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, #3b8fd4 100%);
  color: #fff;
  text-align: center;
  padding: 48px 24px 40px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-company {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
  position: relative;
}

.hero-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 4px;
  position: relative;
}

.hero-subtitle {
  font-size: 14px;
  opacity: 0.8;
  position: relative;
  letter-spacing: 1px;
}

/* ========== Card ========== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin: 12px 12px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
  line-height: 1.3;
}

.card-body {
  color: var(--text-sub);
  font-size: 14px;
  line-height: 1.8;
}

/* ========== Button ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(26, 111, 186, 0.3);
}

.btn-primary:active {
  box-shadow: 0 2px 8px rgba(26, 111, 186, 0.2);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #e8951a 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(245, 166, 35, 0.3);
}

.btn-accent:active {
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.2);
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
  width: auto;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-area {
  padding: 0 12px;
  margin: 16px 0 64px;
}

/* ========== Form ========== */
.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 111, 186, 0.1);
}

.form-control::placeholder {
  color: var(--text-hint);
}

.form-control.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-error.show {
  display: block;
}

textarea.form-control {
  height: auto;
  min-height: 100px;
  padding: 12px 14px;
  resize: vertical;
}

/* ========== Upload Area ========== */
.upload-area {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafbfc;
  position: relative;
}

.upload-area:active,
.upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-icon {
  font-size: 32px;
  color: var(--text-hint);
  margin-bottom: 6px;
}

.upload-text {
  font-size: 13px;
  color: var(--text-sub);
}

.upload-hint {
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 2px;
}

/* ========== Image Grid ========== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f0f0;
}

.image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-item .btn-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  font-size: 14px;
  line-height: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.image-item .uploading-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
}

/* ========== File List ========== */
.file-list {
  margin-top: 12px;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 8px;
  gap: 10px;
}

.file-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.file-item-info {
  flex: 1;
  min-width: 0;
}

.file-item-name {
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size {
  font-size: 11px;
  color: var(--text-hint);
}

.file-item .btn-delete {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fee2e2;
  border: none;
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.file-item.uploading .file-item-name {
  color: var(--text-hint);
}

/* ========== Bottom Fixed ========== */
.bottom-fixed {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--card-bg);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 99;
}

/* ========== Toast ========== */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: rgba(26, 26, 46, 0.85);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  white-space: nowrap;
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2s forwards;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.toast.success {
  background: rgba(34, 197, 94, 0.9);
}

.toast.error {
  background: rgba(239, 68, 68, 0.9);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ========== Loading ========== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  backdrop-filter: blur(2px);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== Success Page ========== */
.success-page {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  min-height: 100vh;
  background: var(--bg);
}

.success-page.show {
  display: flex;
}

.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(34, 197, 94, 0.3);
}

.success-icon svg {
  width: 36px;
  height: 36px;
}

.success-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.success-desc {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 24px;
}

.success-info {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px 16px;
  box-shadow: var(--shadow);
  text-align: left;
}

.success-info-row {
  display: flex;
  padding: 8px 0;
  font-size: 14px;
}

.success-info-row + .success-info-row {
  border-top: 1px solid var(--border);
}

.success-info-label {
  color: var(--text-hint);
  flex-shrink: 0;
  width: 70px;
}

.success-info-value {
  color: var(--text-main);
  flex: 1;
  word-break: break-all;
}

/* ========== Home Specific ========== */
.home-footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-hint);
  font-size: 12px;
  line-height: 2;
}

/* ========== Responsive Tweaks ========== */
@media screen and (min-width: 481px) {
  .container {
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
  }
}
