/* ===== CSS Variables ===== */
:root {
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light: #DBEAFE;
  --accent: #10B981;
  --accent-dark: #059669;
  --text: #1F2937;
  --text-light: #6B7280;
  --bg: #FFFFFF;
  --bg-gray: #F9FAFB;
  --border: #E5E7EB;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1200px;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

a:hover {
  color: var(--primary-dark);
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  font-family: 'Poppins', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

h1 { font-size: 1.75rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.125rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; color: var(--text-light); }

@media (min-width: 768px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container { padding: 0 2rem; }
}

main {
  flex: 1;
}

/* ===== Header ===== */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.95);
}

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

.logo {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo svg {
  width: 28px;
  height: 28px;
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 1.5rem;
}

.nav-desktop a {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-desktop a:hover {
  color: var(--primary);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: inherit;
}

.nav-dropdown-btn:hover {
  color: var(--primary);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 0.5rem 0;
  z-index: 50;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text);
  font-size: 0.875rem;
}

.nav-dropdown-menu a:hover {
  background: var(--bg-gray);
  color: var(--primary);
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: transform 0.3s, opacity 0.3s;
  border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-menu {
  display: none;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu a {
  display: block;
  padding: 0.75rem 0;
  color: var(--text);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.mobile-menu a:last-child {
  border-bottom: none;
}

@media (min-width: 768px) {
  .nav-desktop { display: flex; }
  .hamburger { display: none; }
}

/* ===== Hero / Tool Section ===== */
.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, #EFF6FF 100%);
  padding: 1.5rem 0 2rem;
}

.hero h1 {
  text-align: center;
  color: var(--text);
}

.hero-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto 1.5rem;
}

/* ===== Tool Card ===== */
.tool-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: 900px;
  margin: 0 auto;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 768px) {
  .tool-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.tool-left, .tool-right {
  padding: 1.25rem;
}

.tool-left {
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .tool-left {
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
}

.tool-section-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

/* ===== Upload Area ===== */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

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

.upload-area svg {
  width: 48px;
  height: 48px;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

.upload-area p {
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text);
}

.upload-area span {
  font-size: 0.8rem;
  color: var(--text-light);
}

.upload-area input[type="file"] {
  display: none;
}

/* ===== Preview Canvas ===== */
.preview-container {
  position: relative;
  width: 100%;
  background: #f3f4f6;
  border-radius: var(--radius-sm);
  overflow: hidden;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.preview-container canvas {
  max-width: 100%;
  max-height: 400px;
  display: block;
}

.preview-placeholder {
  text-align: center;
  color: var(--text-light);
  padding: 2rem;
}

.preview-placeholder svg {
  width: 64px;
  height: 64px;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

/* ===== Signature Tabs ===== */
.sig-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}

.sig-tab {
  flex: 1;
  padding: 0.625rem 0.5rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  text-align: center;
}

.sig-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.sig-tab:hover {
  color: var(--primary);
}

.sig-panel {
  display: none;
}

.sig-panel.active {
  display: block;
}

/* ===== Signature Pad (Draw) ===== */
.sig-pad-wrapper {
  position: relative;
}

.sig-pad {
  width: 100%;
  height: 150px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: crosshair;
  touch-action: none;
  background: #fff;
}

.sig-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.sig-control-group {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.sig-control-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
}

.color-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.color-btn.active {
  border-color: var(--primary);
  transform: scale(1.15);
}

.color-btn[data-color="black"] { background: #000; }
.color-btn[data-color="blue"] { background: #1D4ED8; }
.color-btn[data-color="red"] { background: #DC2626; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* ===== Signature Upload ===== */
.sig-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.sig-upload-area:hover {
  border-color: var(--primary);
}

.sig-upload-preview {
  max-height: 80px;
  margin: 0.5rem auto 0;
}

/* ===== Signature Type ===== */
.sig-type-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.sig-type-input:focus {
  border-color: var(--primary);
}

.font-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.font-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 0.2s, background 0.2s;
}

.font-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.font-btn:hover {
  border-color: var(--primary);
}

/* ===== Signature Position Controls ===== */
.position-controls {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.position-controls .sig-control-group {
  margin-bottom: 0.5rem;
  width: 100%;
}

.position-controls label {
  min-width: 40px;
}

.position-controls input[type="range"] {
  flex: 1;
  width: auto;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  min-height: 44px;
  min-width: 44px;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-dark);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.btn svg {
  width: 18px;
  height: 18px;
}

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

.tool-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ===== SEO Content Sections ===== */
.seo-content {
  padding: 3rem 0;
}

.seo-section {
  margin-bottom: 3rem;
}

.seo-section:last-child {
  margin-bottom: 0;
}

.seo-section h2 {
  color: var(--text);
  margin-bottom: 1rem;
  position: relative;
  padding-bottom: 0.75rem;
}

.seo-section h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.seo-section p,
.seo-section li {
  color: var(--text-light);
  line-height: 1.8;
}

/* Steps */
.steps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .steps {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .steps {
    grid-template-columns: repeat(4, 1fr);
  }
}

.step {
  background: var(--bg-gray);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  position: relative;
}

.step-number {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0 auto 0.75rem;
}

.step h3 {
  font-size: 0.95rem;
  margin-bottom: 0.375rem;
}

.step p {
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* Features grid */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .features-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  background: var(--bg-gray);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.feature-card .feature-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.feature-card h3 {
  margin-bottom: 0.375rem;
}

.feature-card p {
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* Use cases list */
.use-cases-list {
  list-style: none;
  columns: 1;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 640px) {
  .use-cases-list {
    columns: 2;
  }
}

.use-cases-list li {
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
  break-inside: avoid;
}

.use-cases-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
}

/* Guidelines */
.guidelines-list {
  list-style: none;
  margin-top: 1rem;
}

.guidelines-list li {
  padding: 0.625rem 0 0.625rem 2rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.guidelines-list li:last-child {
  border-bottom: none;
}

.guidelines-list li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
}

/* ===== FAQ ===== */
.faq-list {
  margin-top: 1rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text);
  transition: background 0.2s;
}

.faq-item summary:hover {
  background: var(--bg-gray);
}

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--primary);
  flex-shrink: 0;
  font-weight: 400;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  content: '\2212';
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-answer {
  padding: 0 1.25rem 1rem;
  color: var(--text-light);
  line-height: 1.8;
}

/* ===== Footer ===== */
.footer {
  background: var(--text);
  color: #D1D5DB;
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.footer-brand p {
  color: #9CA3AF;
  font-size: 0.875rem;
  margin-bottom: 0;
}

.footer-links h4 {
  color: #fff;
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  display: block;
  color: #9CA3AF;
  font-size: 0.8rem;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid #374151;
  padding-top: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: #6B7280;
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ===== Loading Spinner ===== */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

/* ===== Breadcrumb ===== */
.breadcrumb {
  padding: 0.75rem 0;
  font-size: 0.8rem;
  color: var(--text-light);
}

.breadcrumb a {
  color: var(--text-light);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb span {
  margin: 0 0.375rem;
}

/* ===== Static Page Content ===== */
.page-content {
  padding: 2rem 0 3rem;
  max-width: 800px;
  margin: 0 auto;
}

.page-content h1 {
  margin-bottom: 1.5rem;
}

.page-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.page-content p,
.page-content li {
  line-height: 1.8;
  color: var(--text-light);
}

.page-content ul,
.page-content ol {
  margin-left: 1.25rem;
  margin-bottom: 1rem;
}

.page-content li {
  margin-bottom: 0.375rem;
}

/* ===== Passport Photo Tool ===== */
.crop-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.preset-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.preset-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.preset-btn:hover {
  border-color: var(--primary);
}

.bg-colors {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.bg-color-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.bg-color-btn.active {
  border-color: var(--primary);
  transform: scale(1.15);
}

.bg-color-btn[data-bg="white"] { background: #fff; }
.bg-color-btn[data-bg="blue"] { background: #BFDBFE; }
.bg-color-btn[data-bg="red"] { background: #FECACA; }

/* ===== Photo Resizer Tool ===== */
.size-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.size-inputs label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  display: block;
  margin-bottom: 0.25rem;
}

.size-inputs input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

.size-inputs input:focus {
  border-color: var(--primary);
}

.target-size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.file-info {
  background: var(--bg-gray);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.file-info strong {
  color: var(--text);
}

/* ===== Toast Notifications ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}

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

/* ===== CTA Banner ===== */
.cta-banner {
  background: linear-gradient(135deg, var(--primary) 0%, #3B82F6 100%);
  color: #fff;
  padding: 2.5rem 1.5rem;
  border-radius: var(--radius);
  text-align: center;
  margin: 2rem 0;
}

.cta-banner h2 {
  color: #fff;
  margin-bottom: 0.5rem;
}

.cta-banner p {
  color: rgba(255,255,255,0.9);
  margin-bottom: 1.25rem;
}

.cta-banner .btn {
  background: #fff;
  color: var(--primary);
}

.cta-banner .btn:hover {
  background: #F3F4F6;
}

/* ===== Print Hidden ===== */
@media print {
  .header, .footer, .seo-content { display: none; }
}
