/* ================================================================
   Photo35x45.com – Main Stylesheet
   Mobile-first, modern, multilingual (LTR + RTL)
   ================================================================ */

/* ─── CSS Custom Properties ─────────────────────────────────── */
:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #eff6ff;
  --accent:         #3b82f6;
  --success:        #16a34a;
  --success-light:  #f0fdf4;
  --error:          #dc2626;
  --error-light:    #fef2f2;
  --warning:        #d97706;

  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --white:    #ffffff;
  --bg:       #f0f4f8;
  --bg-card:  #ffffff;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.08);
  --shadow-xl: 0 20px 60px rgba(37,99,235,.15), 0 8px 24px rgba(0,0,0,.1);

  --transition: all .25s cubic-bezier(.4,0,.2,1);
  --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-ar: 'Noto Sans Arabic', 'Segoe UI', system-ui, sans-serif;

  --header-h: 64px;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Arabic RTL */
body[dir="rtl"],
body.lang-ar {
  font-family: var(--font-ar);
  direction: rtl;
  text-align: right;
}

h1,h2,h3,h4 { line-height: 1.25; font-weight: 700; }
a { text-decoration: none; color: inherit; }
ul, ol { padding-left: 0; list-style: none; }
body.lang-ar ul, body.lang-ar ol { padding-right: 0; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input[type="file"] { display: none; }

/* ─── Container ──────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ─── Utility ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.accent { color: var(--primary); }

/* ─── Header ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-900);
}
.logo i { font-size: 1.5rem; color: var(--primary); }
.logo .accent { color: var(--primary); }

/* Language Switcher */
.lang-switcher {
  display: flex;
  gap: .25rem;
  background: var(--gray-100);
  padding: .25rem;
  border-radius: var(--radius);
}

.lang-btn {
  padding: .3rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-500);
  transition: var(--transition);
  letter-spacing: .04em;
}
.lang-btn:hover { color: var(--gray-800); background: var(--gray-200); }
.lang-btn.active {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* ─── Ad Leaderboard ─────────────────────────────────────────── */
.ad-leaderboard {
  background: var(--gray-100);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: center;
  padding: .5rem 1rem;
}

.ad-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--gray-400);
  font-size: .75rem;
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--gray-50);
}

.ad-leaderboard .ad-placeholder {
  width: 100%;
  max-width: 728px;
  height: 90px;
}

.ad-sidebar .ad-placeholder.ad-medium {
  width: 300px;
  height: 250px;
  flex-direction: column;
}

/* ─── Main Layout ─────────────────────────────────────────────── */
.main-content {
  padding: 2rem 1rem 4rem;
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  grid-template-areas:
    "hero"
    "upload"
    "result"
    "error"
    "info"
    "ad";
}

/* Desktop: sidebar ad */
@media (min-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr 320px;
    grid-template-areas:
      "hero  hero"
      "upload ad"
      "result result"
      "error  error"
      "info   info";
  }
  .ad-sidebar { grid-area: ad; }
}

.hero-section  { grid-area: hero; }
.upload-section { grid-area: upload; }
.result-section { grid-area: result; }
#serverError   { grid-area: error; }
.info-section  { grid-area: info; }
.ad-sidebar    { grid-area: ad; display: flex; justify-content: center; align-items: flex-start; }

/* ─── Hero ────────────────────────────────────────────────────── */
.hero-section {
  text-align: center;
  padding: 1.5rem 0 .5rem;
}

.hero-section h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  color: var(--gray-900);
  margin-bottom: .75rem;
}

.hero-sub {
  font-size: clamp(.9rem, 2vw, 1.1rem);
  color: var(--gray-500);
  margin-bottom: 1.25rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .85rem;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid rgba(37,99,235,.2);
}
.badge i { font-size: .75rem; }

/* ─── Upload Card ─────────────────────────────────────────────── */
.upload-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

/* Drop Zone */
.drop-zone {
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: linear-gradient(135deg, #fafbff 0%, #f0f4ff 100%);
  border-bottom: 2px dashed var(--gray-200);
  outline: none;
}
.drop-zone:focus { box-shadow: inset 0 0 0 3px var(--primary); }
.drop-zone.drag-over {
  background: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.01);
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  pointer-events: none;
}

.drop-icon-wrap {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #60a5fa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37,99,235,.3);
  transition: var(--transition);
}
.drop-zone.drag-over .drop-icon-wrap {
  transform: scale(1.15) rotate(5deg);
}
.drop-icon { font-size: 2.5rem; color: white; }

.drop-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gray-800);
}
.drop-hint {
  font-size: .875rem;
  color: var(--gray-500);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.6rem;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  pointer-events: all;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37,99,235,.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover {
  background: var(--gray-200);
  transform: translateY(-1px);
}

.upload-btn { margin-top: .25rem; }

/* Validation Error */
.validation-error {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--error-light);
  color: var(--error);
  font-size: .9rem;
  font-weight: 500;
  border-top: 1px solid rgba(220,38,38,.2);
}
.validation-error i { font-size: 1.1rem; flex-shrink: 0; }

/* Progress Bar */
.progress-wrap {
  padding: 1rem 1.25rem;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}
.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  color: var(--gray-500);
  margin-bottom: .5rem;
  font-weight: 500;
}
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #60a5fa, var(--primary));
  background-size: 200% 100%;
  transition: width .3s ease;
  animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Result Section ──────────────────────────────────────────── */
.result-section { animation: fadeInUp .5s ease; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.result-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.25rem 1.5rem;
  background: var(--success-light);
  border-bottom: 1px solid rgba(22,163,74,.2);
}
.success-icon { font-size: 1.5rem; color: var(--success); }
.result-header h2 { font-size: 1.15rem; color: var(--gray-800); }

.result-body {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 1.5rem;
  align-items: flex-start;
}

/* Preview */
.preview-wrap { text-align: center; }

.preview-frame {
  position: relative;
  display: inline-block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 3px solid var(--gray-200);
  background: var(--gray-100);
}
.preview-frame img {
  width: 138px;   /* 35mm preview */
  height: 177px;  /* 45mm preview */
  object-fit: cover;
  display: block;
}
.preview-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(37,99,235,.85);
  color: white;
  font-size: .7rem;
  font-weight: 700;
  text-align: center;
  padding: .2rem;
  letter-spacing: .05em;
}
.preview-info {
  margin-top: .5rem;
  font-size: .78rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* Download */
.download-section { flex: 1; min-width: 240px; }
.download-section h3 {
  font-size: .95rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.dl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  padding: 1rem .5rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: .95rem;
  transition: var(--transition);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}
.dl-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,.12);
  opacity: 0;
  transition: opacity .2s;
}
.dl-btn:hover::after { opacity: 1; }
.dl-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.dl-btn:active { transform: translateY(0); }

.dl-btn i { font-size: 1.5rem; }
.dl-btn small { font-size: .7rem; font-weight: 400; opacity: .85; }

.dl-jpg { background: linear-gradient(135deg,#f59e0b,#d97706); color: white; }
.dl-png { background: linear-gradient(135deg,#10b981,#059669); color: white; }
.dl-pdf { background: linear-gradient(135deg,#ef4444,#dc2626); color: white; }
.dl-tif { background: linear-gradient(135deg,#8b5cf6,#7c3aed); color: white; }

.restart-btn { width: 100%; justify-content: center; }

/* ─── Server Error Toast ──────────────────────────────────────── */
.server-error {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--error-light);
  border: 1px solid rgba(220,38,38,.3);
  border-radius: var(--radius);
  color: var(--error);
  animation: fadeInUp .4s ease;
}
.server-error i:first-child { font-size: 1.3rem; flex-shrink: 0; margin-top: .1rem; }
.server-error strong { display: block; margin-bottom: .15rem; font-size: .95rem; }
.server-error p { font-size: .875rem; color: var(--gray-600); }
.error-close {
  margin-left: auto;
  color: var(--gray-400);
  padding: .2rem;
  transition: var(--transition);
}
.error-close:hover { color: var(--error); }
body.lang-ar .error-close { margin-left: 0; margin-right: auto; }

/* ─── Info / SEO Section ──────────────────────────────────────── */
.info-section { margin-top: 1rem; }

.info-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 2rem;
}
@media (min-width: 640px)  { .info-grid { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 1024px) { .info-grid { grid-template-columns: repeat(4,1fr); } }

.info-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}
.info-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-3px);
  border-color: var(--primary);
}

.info-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary);
  font-size: 1.2rem;
}

.info-card h3 {
  font-size: .95rem;
  color: var(--gray-800);
  margin-bottom: .75rem;
  font-weight: 700;
}

.info-card ul li,
.info-card ol li {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  font-size: .85rem;
  color: var(--gray-600);
  padding: .3rem 0;
  border-bottom: 1px solid var(--gray-100);
}
.info-card ul li:last-child,
.info-card ol li:last-child { border-bottom: none; }

.info-card ol {
  counter-reset: list-counter;
  list-style: none;
}
.info-card ol li {
  counter-increment: list-counter;
}
.info-card ol li::before {
  content: counter(list-counter);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .05rem;
}

.info-card ul li .fa-check-circle { color: var(--success); font-size: .85rem; flex-shrink: 0; margin-top: .15rem; }

/* SEO text */
.seo-text {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.seo-text h2 {
  font-size: 1.3rem;
  color: var(--gray-800);
  margin-bottom: 1.25rem;
}
.seo-text p {
  font-size: .9rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
  line-height: 1.8;
}
.seo-text p:last-child { margin-bottom: 0; }
.seo-text strong { color: var(--gray-800); }

/* ─── Footer ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 2rem 1rem;
  margin-top: 2rem;
  text-align: center;
}
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: .75rem; }
.footer-logo {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-200);
}
.footer-logo i { color: var(--primary); }
.footer-copy { font-size: .82rem; }
.footer-disclaimer { font-size: .78rem; color: var(--gray-500); max-width: 480px; }

/* ─── Responsive ──────────────────────────────────────────────── */
@media (min-width: 640px) {
  .drop-zone { padding: 3rem 2rem; }
  .result-body { flex-wrap: nowrap; }
  .download-grid { grid-template-columns: repeat(4,1fr); }
}

@media (max-width: 639px) {
  .download-grid { grid-template-columns: repeat(2,1fr); }
  .preview-frame img { width: 110px; height: 141px; }
}

/* ─── RTL specific overrides ──────────────────────────────────── */
body.lang-ar .info-card ul li,
body.lang-ar .info-card ol li {
  flex-direction: row-reverse;
}
body.lang-ar .info-card ol li::before {
  margin-top: .05rem;
}
body.lang-ar .lang-switcher { direction: ltr; }
body.lang-ar .drop-zone { direction: rtl; }
body.lang-ar .download-section h3 { letter-spacing: 0; }

/* ─── Pulse animation for drop icon ───────────────────────────── */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(37,99,235,.4); }
  70%  { box-shadow: 0 0 0 16px rgba(37,99,235,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); }
}
.drop-icon-wrap { animation: pulse-ring 2.5s ease-in-out infinite; }
.drop-zone.drag-over .drop-icon-wrap { animation: none; }

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Focus Visible ───────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── FAQ Section ─────────────────────────────────────────────── */
.faq-section {
  background: linear-gradient(180deg, var(--bg) 0%, var(--gray-100) 100%);
  padding: 4rem 1rem;
  border-top: 1px solid var(--gray-200);
}

.faq-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
  justify-content: center;
  flex-direction: column;
  text-align: center;
}

.faq-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #60a5fa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.4rem;
  box-shadow: 0 6px 20px rgba(37,99,235,.3);
  flex-shrink: 0;
}

.faq-header h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--gray-900);
}

.faq-grid {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.faq-item {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.faq-item:hover {
  border-color: rgba(37,99,235,.3);
  box-shadow: var(--shadow);
}
.faq-item.open {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(37,99,235,.12);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.4rem;
  text-align: left;
  font-size: .95rem;
  font-weight: 600;
  color: var(--gray-800);
  background: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.4;
}
.faq-question:hover { color: var(--primary); background: var(--primary-light); }
.faq-item.open .faq-question { color: var(--primary); background: var(--primary-light); }

.faq-chevron {
  font-size: .8rem;
  color: var(--gray-400);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
}
.faq-item.open .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-answer {
  overflow: hidden;
  max-height: 0;
  transition: max-height .35s cubic-bezier(.4,0,.2,1), padding .3s ease;
  padding: 0 1.4rem;
}
.faq-answer:not([hidden]) {
  max-height: 300px;
  padding: .1rem 1.4rem 1.2rem;
}
.faq-answer p {
  font-size: .9rem;
  color: var(--gray-600);
  line-height: 1.75;
}
.faq-answer strong { color: var(--gray-800); }

/* RTL FAQ */
body.lang-ar .faq-question { text-align: right; flex-direction: row-reverse; }

/* ─── Footer Nav ──────────────────────────────────────────────── */
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  justify-content: center;
  margin: .75rem 0;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  color: var(--gray-400);
  transition: var(--transition);
}
.footer-link:hover { color: var(--gray-100); }
.footer-link i { font-size: .75rem; }

/* ─── Blog shared header ──────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  color: white;
  padding: 4rem 1rem 3rem;
  text-align: center;
}
.page-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: .75rem; }
.page-hero p  { font-size: 1rem; opacity: .85; max-width: 560px; margin: 0 auto; }

/* ─── Print ───────────────────────────────────────────────────── */
@media print {
  .site-header, .ad-leaderboard, .ad-sidebar, .info-section,
  .faq-section, .site-footer { display: none; }
  .main-content { padding: 0; }
}
