@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 1000;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
}

.logo span {
  font-size: 0.75rem;
  opacity: 0.8;
  display: block;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-links a:hover {
  color: white;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 50%, var(--secondary) 100%);
  color: white;
  padding: 3rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  position: relative;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  position: relative;
}

/* Tools Grid */
.tools-section {
  padding: 2rem 0;
}

.section-title {
  text-align: center;
  margin-bottom: 2rem;
}

.section-title h2 {
  font-size: 1.8rem;
  color: var(--text);
  margin-bottom: 0.3rem;
}

.section-title p {
  color: var(--text-light);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.2rem;
  padding: 0 0 2rem;
}

.tool-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transform: scaleX(0);
  transition: transform 0.3s;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card .icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
  position: relative;
}

.tool-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.tool-card p {
  font-size: 0.8rem;
  color: var(--text-light);
}

.badge-new {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

/* Icon colors */
.icon-blue { background: #dbeafe; color: #2563eb; }
.icon-purple { background: #ede9fe; color: #7c3aed; }
.icon-green { background: #d1fae5; color: #059669; }
.icon-orange { background: #ffedd5; color: #ea580c; }
.icon-red { background: #fee2e2; color: #dc2626; }
.icon-teal { background: #ccfbf1; color: #0d9488; }
.icon-pink { background: #fce7f3; color: #db2777; }
.icon-yellow { background: #fef3c7; color: #d97706; }
.icon-indigo { background: #e0e7ff; color: #4338ca; }
.icon-cyan { background: #cffafe; color: #0891b2; }

/* Tool Page Styles */
.tool-page {
  padding: 2rem 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

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

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

.tool-header {
  text-align: center;
  margin-bottom: 2rem;
}

.tool-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.tool-header p {
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
}

.tool-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* Upload Area */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #f8fafc;
  position: relative;
}

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

.upload-area .upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-area h3 {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

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

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 14px rgba(79,70,229,0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79,70,229,0.5);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #059669);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #dc2626);
  color: white;
}

.btn-full {
  width: 100%;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

select.form-control {
  cursor: pointer;
}

/* Preview Area */
.preview-area {
  margin-top: 1.5rem;
  text-align: center;
}

.preview-area img {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.preview-area canvas {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Action Bar */
.action-bar {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Grid layout for inputs */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.input-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* Result area */
.result-area {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f0fdf4;
  border-radius: var(--radius-sm);
  border: 1px solid #bbf7d0;
  text-align: center;
}

.result-area.error {
  background: #fef2f2;
  border-color: #fecaca;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.3s;
}

/* Image list for batch */
.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.image-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1;
}

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

.image-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(239,68,68,0.9);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-item .order-num {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  background: rgba(79,70,229,0.9);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Footer */
.footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  padding: 2rem 0;
  text-align: center;
  margin-top: 2rem;
}

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

/* QR Code specific */
#qrcode {
  display: inline-block;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Age Calculator */
.age-result {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

.age-box {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  text-align: center;
}

.age-box .number {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.age-box .label {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 0.3rem;
}

/* Passport Photo */
.passport-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 1rem;
}

.passport-photo-single {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .tools-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.8rem; }
  .tool-card { padding: 1rem; }
  .tool-card .icon { width: 45px; height: 45px; font-size: 1.3rem; }
  .tool-container { padding: 1.2rem; }
  .input-grid, .input-grid-3 { grid-template-columns: 1fr; }
  .age-result { grid-template-columns: 1fr; }
  .nav-links { display: none; }
}

/* Download link styling */
.download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--success);
  font-weight: 600;
  text-decoration: none;
  padding: 0.5rem 1rem;
  background: #d1fae5;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
}

.download-link:hover {
  background: #a7f3d0;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-weight: 500;
  color: var(--text-light);
  transition: all 0.3s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Size info */
.size-info {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.size-badge {
  background: #f1f5f9;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Tool description cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.feature-card {
  background: #f8fafc;
  padding: 1rem;
  border-radius: var(--radius-sm);
  text-align: center;
}

.feature-card .feat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.feature-card h4 {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.feature-card p {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Color picker */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-picker-wrapper input[type="color"] {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}

/* Range slider */
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  appearance: none;
  background: #e2e8f0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(79,70,229,0.4);
}
