/* ============================================================
   HEIC Converter – Global Styles
   Color palette: #0f2547 (dark navy), #1a3a6b (mid navy),
                  #2563eb (accent blue), #f8faff (light bg)
   ============================================================ */

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

:root {
  --navy:        #0f2547;
  --navy-mid:    #1a3a6b;
  --blue:        #2563eb;
  --blue-light:  #3b82f6;
  --blue-pale:   #dbeafe;
  --white:       #ffffff;
  --bg:          #f8faff;
  --gray-light:  #e2e8f0;
  --gray-mid:    #94a3b8;
  --gray-dark:   #475569;
  --success:     #22c55e;
  --error:       #ef4444;
  --radius:      12px;
  --radius-sm:   6px;
  --shadow:      0 4px 24px rgba(15,37,71,.10);
  --shadow-lg:   0 8px 40px rgba(15,37,71,.16);
  --transition:  .22s cubic-bezier(.4,0,.2,1);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--navy);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--navy); }

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

/* ---------- Accent ---------- */
.accent { color: var(--blue); }

/* ---------- Brand logo ---------- */
.logo-heic {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  color: #1a1a2e;
  font-size: 1.6rem;
}
.logo-free {
  font-weight: 800;
  color: #4f6ef7;
  font-size: 1.6rem;
}
.logo-dot {
  color: #4f6ef7;
  font-weight: 800;
  font-size: 1.6rem;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--white);
  text-decoration: none;
}

.logo-icon { font-size: 1.4rem; }
.logo .accent { color: #60a5fa; }

.site-nav { display: flex; gap: 24px; }
.site-nav a {
  color: rgba(255,255,255,.78);
  font-size: .95rem;
  font-weight: 500;
}
.site-nav a:hover { color: var(--white); }

/* ---------- Ad Blocks ---------- */
.ad-wrapper {
  background: var(--white);
  border-top: 1px solid var(--gray-light);
  border-bottom: 1px solid var(--gray-light);
  padding: 12px 0;
}

.ad-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 90px;
  background: linear-gradient(135deg, #f8f9ff 0%, #eef0ff 100%);
  border: 2px dashed #c0c8ff;
  border-radius: 12px;
  padding: 16px 24px;
}

.ad-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
}

.ad-main {
  font-size: 1.1rem;
  font-weight: 700;
  color: #8892b0;
  letter-spacing: .01em;
}

.ad-sub {
  font-size: .78rem;
  color: #a0aac0;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .ad-block {
    flex-direction: column;
    gap: 4px;
    text-align: center;
    min-height: 70px;
  }
  .ad-sub { white-space: normal; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white);
  padding: 60px 0 48px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -.5px;
  margin-bottom: 14px;
}

.hero h1 .accent { color: #60a5fa; }

.hero-sub {
  font-size: 1.05rem;
  color: rgba(255,255,255,.8);
  margin-bottom: 20px;
}

.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 100px;
  padding: 8px 18px;
  font-size: .88rem;
  color: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
}

/* ---------- Tool Section ---------- */
.tool-section {
  padding: 40px 0 60px;
  flex: 1;
}

/* Controls Bar */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 16px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.format-selector, .quality-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.format-selector label, .quality-wrapper label {
  font-weight: 600;
  font-size: .92rem;
  color: var(--navy);
  white-space: nowrap;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--gray-dark);
  font-size: .8rem;
}

select {
  appearance: none;
  background: var(--bg);
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 8px 32px 8px 12px;
  font-size: .95rem;
  font-family: var(--font);
  color: var(--navy);
  cursor: pointer;
  transition: border-color var(--transition);
  min-width: 180px;
}

select:focus { outline: none; border-color: var(--blue); }

.quality-wrapper {
  flex-wrap: wrap;
}

#jpgQuality {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 5px;
  border-radius: 5px;
  background: linear-gradient(to right, var(--blue) 0%, var(--blue) 90%, var(--gray-light) 90%);
  outline: none;
  cursor: pointer;
}

#jpgQuality::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(37,99,235,.4);
  cursor: pointer;
  transition: background var(--transition);
}

#jpgQuality::-webkit-slider-thumb:hover { background: var(--navy); }

/* Firefox slider thumb */
#jpgQuality::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--white);
  box-shadow: 0 1px 4px rgba(37,99,235,.4);
  cursor: pointer;
}
#jpgQuality::-moz-range-thumb:hover { background: var(--navy); }
#jpgQuality::-moz-range-track {
  height: 5px;
  border-radius: 5px;
  background: var(--gray-light);
  border: none;
}

/* Drop Zone */
.drop-zone {
  background: var(--white);
  border: 2.5px dashed var(--blue-light);
  border-radius: var(--radius);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  box-shadow: var(--shadow);
}

.drop-zone:hover, .drop-zone.drag-over {
  background: var(--blue-pale);
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.drop-icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
  filter: drop-shadow(0 2px 6px rgba(37,99,235,.2));
}

.drop-zone h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.drop-zone p {
  color: var(--gray-dark);
  margin-bottom: 20px;
  font-size: .95rem;
}

.drop-hint {
  margin-top: 16px !important;
  font-size: .82rem !important;
  color: var(--gray-mid) !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 3px 12px rgba(37,99,235,.35);
}

.btn-primary:hover {
  background: var(--navy);
  box-shadow: 0 4px 16px rgba(15,37,71,.35);
  transform: translateY(-1px);
  color: var(--white);
}

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

.btn-outline {
  background: transparent;
  color: var(--gray-dark);
  border: 1.5px solid var(--gray-light);
}

.btn-outline:hover {
  border-color: var(--error);
  color: var(--error);
  background: #fff5f5;
}

.btn-sm {
  padding: 6px 14px;
  font-size: .82rem;
}

/* File List */
.file-list-wrapper {
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-top: 20px;
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--gray-light);
}

.file-list-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
}

.batch-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.file-list {
  list-style: none;
  max-height: 480px;
  overflow-y: auto;
}

.file-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-light);
  transition: background var(--transition);
}

.file-item:last-child { border-bottom: none; }
.file-item:hover { background: #fafbff; }

.file-info {
  min-width: 0;
}

.file-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.file-meta {
  font-size: .78rem;
  color: var(--gray-mid);
  margin-bottom: 8px;
}

/* Progress bar */
.progress-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--gray-light);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--blue-light));
  width: 0%;
  transition: width .3s ease;
}

.progress-bar-fill.done {
  background: linear-gradient(90deg, var(--success), #4ade80);
}

.progress-bar-fill.error {
  background: linear-gradient(90deg, var(--error), #f87171);
}

.progress-label {
  font-size: .75rem;
  color: var(--gray-dark);
  min-width: 38px;
  text-align: right;
}

.status-text {
  font-size: .78rem;
  font-weight: 500;
  margin-top: 4px;
}
.status-text.pending  { color: var(--gray-mid); }
.status-text.working  { color: var(--blue); }
.status-text.done     { color: var(--success); }
.status-text.error    { color: var(--error); }

/* Download button column */
.file-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

/* ---------- How It Works ---------- */
.how-it-works {
  background: var(--navy);
  color: var(--white);
  padding: 64px 0;
}

.section-title {
  text-align: center;
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 40px;
  letter-spacing: -.3px;
}

.how-it-works .section-title { color: var(--white); }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
}

.step {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  font-size: 1.3rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 14px rgba(37,99,235,.5);
}

.step h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--white);
}

.step p { font-size: .9rem; color: rgba(255,255,255,.7); }

/* ---------- FAQ ---------- */
.faq-section {
  padding: 64px 0;
  background: var(--bg);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
}

.faq-item {
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow);
}

.faq-item h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}

.faq-item p {
  font-size: .9rem;
  color: var(--gray-dark);
  line-height: 1.65;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.55);
  text-align: center;
  padding: 22px 0;
  font-size: .83rem;
}

.site-footer .footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.site-footer .footer-links a {
  color: rgba(255,255,255,.5);
  font-size: .82rem;
  text-decoration: none;
  transition: color var(--transition);
}

.site-footer .footer-links a:hover {
  color: rgba(255,255,255,.9);
}

/* ---------- Inner pages (Privacy, Terms, Contact) ---------- */
.page-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: var(--white);
  padding: 48px 0 36px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(1.4rem, 3.5vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -.4px;
  margin-bottom: 8px;
}

.page-hero p {
  font-size: .95rem;
  color: rgba(255,255,255,.72);
}

.page-body {
  padding: 52px 0 72px;
  flex: 1;
}

/* Legal content (Privacy Policy & Terms) */
.legal-content {
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 40px 48px;
  box-shadow: var(--shadow);
  line-height: 1.75;
  color: var(--gray-dark);
  font-size: .95rem;
}

.legal-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 32px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-light);
}

.legal-content h2:first-child { margin-top: 0; }

.legal-content p  { margin-bottom: 12px; }
.legal-content ul { margin: 10px 0 14px 20px; }
.legal-content li { margin-bottom: 6px; }

.legal-content a {
  color: var(--blue);
  text-decoration: underline;
}

.legal-meta {
  font-size: .82rem;
  color: var(--gray-mid);
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-light);
}

/* Contact form */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

.contact-form-card {
  background: var(--white);
  border: 1px solid var(--gray-light);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: var(--shadow);
}

.contact-form-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .95rem;
  font-family: var(--font);
  color: var(--navy);
  transition: border-color var(--transition);
  resize: vertical;
}

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

.form-group textarea { min-height: 130px; }

.form-submit { width: 100%; justify-content: center; margin-top: 6px; }

.contact-info-card {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 32px 28px;
  color: var(--white);
}

.contact-info-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--white);
}

.contact-info-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  font-size: .9rem;
  color: rgba(255,255,255,.78);
  line-height: 1.5;
}

.contact-info-item .ci-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.contact-info-item a {
  color: #60a5fa;
}

.contact-note {
  font-size: .8rem;
  color: rgba(255,255,255,.45);
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12);
  line-height: 1.55;
}

@media (max-width: 700px) {
  .contact-grid { grid-template-columns: 1fr; }
  .legal-content { padding: 28px 20px; }
  .contact-form-card { padding: 28px 20px; }
}

/* ---------- Scrollbar ---------- */
.file-list::-webkit-scrollbar { width: 5px; }
.file-list::-webkit-scrollbar-track { background: transparent; }
.file-list::-webkit-scrollbar-thumb { background: var(--gray-light); border-radius: 5px; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .controls-bar { flex-direction: column; align-items: flex-start; }
  .file-item { grid-template-columns: 1fr; }
  .file-actions { flex-direction: row; align-items: center; }
  .file-list-header { flex-direction: column; align-items: flex-start; }
  .hero h1 { font-size: 1.5rem; }
  .faq-grid { grid-template-columns: 1fr; }
  .drop-zone { padding: 36px 16px; }
  .drop-zone h2 { font-size: 1.1rem; }
  .site-nav { display: none; }
}

/* ---------- Spinner animation ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(37,99,235,.25);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

/* ---------- Toast / snackbar ---------- */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--navy);
  color: var(--white);
  padding: 12px 28px;
  border-radius: 100px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s;
  opacity: 0;
  pointer-events: none;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
