/* PicTools - Clean, Simple CSS */
:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #DBEAFE;
  --success: #10B981;
  --error: #EF4444;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  color: var(--gray-900);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header */
.header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo:hover { opacity: 0.8; }

.nav-dropdown {
  position: relative;
}

.nav-btn {
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover { background: var(--gray-200); }

.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  min-width: 220px;
  padding: 0.5rem;
  z-index: 1000;
}

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

.dropdown-menu a {
  display: block;
  padding: 0.6rem 1rem;
  color: var(--gray-700);
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.9rem;
}

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

/* Main Content */
.main {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}

.page-desc {
  color: var(--gray-500);
  margin-bottom: 2rem;
  font-size: 1.1rem;
}

/* Tool Area */
.tool-area {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 1.5rem;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}

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

.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.drop-zone-text {
  font-size: 1.1rem;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.drop-zone-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
}

.drop-zone input[type="file"] {
  display: none;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  align-items: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.control-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

input[type="number"],
input[type="text"],
select,
textarea {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.95rem;
  width: 100%;
}

input[type="number"] { width: 80px; }
input[type="color"] { width: 50px; height: 36px; border: none; cursor: pointer; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 200px;
  height: 6px;
  border-radius: 3px;
  background: var(--gray-200);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.2rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }

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

.btn-secondary:hover { background: var(--gray-200); }

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

.btn-success:hover { background: #059669; }

/* Preview */
.preview-container {
  margin-top: 1.5rem;
  display: none;
}

.preview-container.active { display: block; }

.preview-image {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.preview-canvas {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  cursor: crosshair;
}

/* Stats */
.stats {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.stat-value.success { color: var(--success); }
.stat-value.error { color: var(--error); }

/* Result */
.result-area {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  display: none;
}

.result-area.active { display: block; }

.result-text {
  font-family: monospace;
  font-size: 0.85rem;
  word-break: break-all;
  max-height: 150px;
  overflow: auto;
  background: var(--gray-50);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

/* Security Note */
.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Footer */
.footer {
  border-top: 1px solid var(--gray-200);
  padding: 2rem;
  margin-top: 2rem;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--gray-500);
  text-decoration: none;
  font-size: 0.9rem;
}

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

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  z-index: 1000;
}

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

.toast.success { background: var(--success); color: #fff; }
.toast.error { background: var(--error); color: #fff; }

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.loading-overlay.active { display: flex; }

/* Position Grid */
.position-grid {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  gap: 4px;
}

.position-grid button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--gray-300);
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.position-grid button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Favicon Grid */
.favicon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.favicon-item {
  text-align: center;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.favicon-item img {
  display: block;
  margin: 0 auto 0.5rem;
}

.favicon-item span {
  font-size: 0.8rem;
  color: var(--gray-500);
}

/* Color Display */
.color-display {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.color-swatch {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

.color-values {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-value code {
  background: var(--gray-100);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Checkbox */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Crop Box */
.crop-container {
  position: relative;
  display: inline-block;
}

.crop-box {
  position: absolute;
  border: 2px solid var(--primary);
  background: rgba(59, 130, 246, 0.1);
  cursor: move;
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--primary);
  border: 2px solid #fff;
  border-radius: 2px;
}

/* Home Page */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--gray-900);
}

.hero p {
  font-size: 1.2rem;
  color: var(--gray-500);
  margin-bottom: 2rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.tool-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tool-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

.tool-card-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.tool-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--gray-900);
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

.tool-card .use-btn {
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header { padding: 0.8rem 1rem; }
  .main { padding: 1.5rem; }
  .hero { padding: 2rem 1rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 1rem; }
  .tools-grid { padding: 0 1rem 2rem; gap: 1rem; }
  .tool-area { padding: 1.5rem; }
  .drop-zone { padding: 2rem 1rem; }
  .controls { flex-direction: column; align-items: stretch; }
  input[type="range"] { width: 100%; }
  .page-title { font-size: 1.5rem; }
}
