/* =========================
   ADVANCED COLOR TOOL STYLES
   Supports Day/Night Mode via CSS Variables
========================= */

.color-tool-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  font-family: 'Poppins', sans-serif;
}

.color-tool-wrapper {
  max-width: 950px;
  margin: 0 auto;
}

/* =========================
   HEADER
========================= */

.color-tool-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  text-align: center;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.color-icon {
  display: inline-block;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.color-tool-subtitle {
  text-align: center;
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 2rem;
  font-weight: 400;
}

/* =========================
   MAIN CARD
========================= */

.color-tool-card {
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
}

/* =========================
   TABS NAVIGATION
========================= */

.color-tabs {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  background: var(--bg);
  padding: 0.5rem;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.color-tab {
  padding: 0.7rem 1.5rem;
  border-radius: 12px;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  white-space: nowrap;
  font-family: 'Poppins', sans-serif;
}

.color-tab:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.color-tab.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

/* =========================
   SECTIONS
========================= */

.color-section {
  display: none;
  animation: fadeSlideIn 0.4s ease;
}

.color-section.active {
  display: block;
}

@keyframes fadeSlideIn {
  from { 
    opacity: 0; 
    transform: translateY(10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* =========================
   COLOR PICKER SECTION
========================= */

.picker-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.color-preview {
  width: 200px;
  height: 200px;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  border: 6px solid var(--surface);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.color-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
  border-radius: 14px;
  pointer-events: none;
}

.color-preview:hover {
  transform: scale(1.02);
  box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

.hidden-picker {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
  pointer-events: none;
}

/* Color Value Inputs */
.color-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: 600px;
}

.value-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.value-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.value-group input {
  padding: 0.8rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.95rem;
  text-align: center;
  transition: all 0.3s ease;
}

.value-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* =========================
   BUTTONS
========================= */

.tool-btn {
  padding: 0.8rem 1.6rem;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Poppins', sans-serif;
}

.tool-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.tool-btn:active {
  transform: translateY(0);
}

.tool-btn.small {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.tool-btn.secondary {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
}

.tool-btn.secondary:hover {
  background: var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

/* =========================
   IMAGE UPLOAD AREA
========================= */

.image-upload-area {
  width: 100%;
  max-width: 600px;
  border: 3px dashed var(--border);
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.image-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.image-upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.02);
}

.image-upload-area .upload-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
}

.image-upload-area .upload-text {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
}

.image-upload-area .upload-hint {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Image Preview */
.image-preview-container {
  width: 100%;
  max-width: 600px;
  position: relative;
  display: none;
}

.image-preview-container.active {
  display: block;
  animation: fadeSlideIn 0.3s ease;
}

.image-preview-container img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--bg);
}

.image-preview-controls {
  display: flex;
  gap: 0.8rem;
  margin-top: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.picked-color-display {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 1.2rem;
  background: var(--bg);
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: 0.8rem;
}

.picked-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* =========================
   COLOR HISTORY
========================= */

.history {
  width: 100%;
  max-width: 600px;
}

.history h4 {
  margin-bottom: 0.8rem;
  color: var(--text);
  font-size: 1rem;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.history-item {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.history-item:hover {
  border-color: var(--primary);
  transform: scale(1.15);
  z-index: 2;
  box-shadow: var(--shadow);
}

.history-item.empty {
  background: var(--bg) !important;
  border: 2px dashed var(--border);
  cursor: default;
}

.history-item.empty:hover {
  transform: none;
  border-color: var(--border);
}

/* =========================
   GRADIENT SECTION
========================= */

.gradient-preview {
  width: 100%;
  height: 250px;
  border-radius: 16px;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: background 0.3s ease;
  border: 1px solid var(--border);
}

.gradient-controls {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.control-row label {
  min-width: 70px;
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Form Elements */
select {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

select:focus {
  outline: none;
  border-color: var(--primary);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow);
}

#angleValue,
#shadowBlurValue,
#shadowSpreadValue,
#shadowXValue,
#shadowYValue,
#shadowOpacityValue {
  min-width: 50px;
  text-align: right;
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

/* =========================
   GRADIENT PRESETS
========================= */

.gradient-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.gradient-preset {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s ease;
}

.gradient-preset:hover {
  transform: scale(1.1);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.gradient-preset.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* =========================
   COLOR STOPS
========================= */

.color-stops h4 {
  margin-bottom: 0.8rem;
  color: var(--text);
}

.stop-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
  background: var(--bg);
  padding: 1rem;
  border-radius: 12px;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.stop-row:hover {
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.stop-row input[type="color"] {
  width: 56px;
  height: 44px;
  padding: 2px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: var(--surface);
}

.stop-row input[type="color"]:hover {
  border-color: var(--primary);
}

.stop-row input[type="range"] {
  flex: 1;
}

.stop-row button {
  background: var(--danger);
  color: white;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stop-row button:hover {
  background: var(--danger-hover);
  transform: scale(1.1);
}

/* =========================
   CSS OUTPUT
========================= */

.gradient-output {
  margin-top: 0.5rem;
}

.gradient-output label {
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  display: block;
}

.gradient-output pre {
  background: #1a1a2e;
  color: #e2e8f0;
  padding: 1.2rem;
  border-radius: 12px;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  overflow-x: auto;
  max-height: 200px;
  line-height: 1.6;
  border: 1px solid #2d2d44;
}

/* Dark mode code output */
[data-theme="dark"] .gradient-output pre,
.dark-mode .gradient-output pre,
.dark .gradient-output pre {
  background: #0d1117;
  border-color: #30363d;
  color: #c9d1d9;
}

.output-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.action-btn {
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
}

.action-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* =========================
   BOX SHADOW SECTION
========================= */

.shadow-preview-box {
  width: 50%;
  margin: 0 auto;
  height: 220px;
  background: var(--bg);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s ease;
  border: 1px solid var(--border);
}

.shadow-preview-inner {
  width: 140px;
  height: 140px;
  background: var(--surface);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-light);
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.shadow-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.shadow-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.shadow-control-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.shadow-control-group input[type="range"] {
  width: 100%;
}

.shadow-control-group input[type="color"] {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: 2px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  padding: 2px;
}

.shadow-control-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* =========================
   ACCESSIBILITY CHECKER
========================= */

.accessibility-checker {
  background: var(--bg);
  padding: 2rem;
  border-radius: 16px;
  border: 1px solid var(--border);
}

.accessibility-checker h3 {
  margin-bottom: 1rem;
  color: var(--text);
}

.accessibility-checker p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.contrast-preview {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
/* Add/update these styles in the accessibility section of style.css */

.contrast-sample {
  padding: 1.5rem 2rem;
  border-radius: 12px;
  text-align: center;
  min-width: 180px;
  border: 1px solid var(--border);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.contrast-sample h5 {
  margin: 0 0 0.3rem 0;
  font-size: 1rem;
}

.contrast-sample p {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.contrast-results {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.contrast-badge {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}

.contrast-badge.pass { 
  background: var(--success); 
  color: #ffffff; 
}

.contrast-badge.fail { 
  background: var(--danger); 
  color: #ffffff; 
}

.contrast-badge.warning { 
  background: var(--warning); 
  color: #1e293b; 
}

/* =========================
   ACTIONS & RESET
========================= */

.actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.clear-all {
  text-align: center;
  margin-top: 1rem;
}

/* =========================
   SEO INFO SECTION
========================= */

.color-info {
  margin-top: 2.5rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.color-info h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.color-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
}

.color-info p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 0.8rem;
}

.color-info ul {
  padding-left: 0;
  list-style: none;
}

.color-info li {
  margin-bottom: 0.6rem;
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.6;
}

.color-features-list li {
  position: relative;
  padding-left: 1.6rem;
}

.color-features-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

.color-usecases-list li {
  position: relative;
  padding-left: 1.4rem;
}

.color-usecases-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
}

.color-info strong {
  color: var(--text);
  font-weight: 700;
}

/* =========================
   RELATED RESOURCES
========================= */

.imagesplit-related {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.imagesplit-related h3 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-size: 1.2rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.related-category h4 {
  color: var(--primary);
  margin-bottom: 0.8rem;
  font-size: 1rem;
}

.related-category ul {
  list-style: none;
  padding: 0;
}

.related-category li {
  margin-bottom: 0.5rem;
}

.related-category a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s ease;
  font-size: 0.9rem;
}

.related-category a:hover {
  color: var(--primary);
}

.related-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* =========================
   RESPONSIVE DESIGN
========================= */

@media (max-width: 1024px) {
  .color-tool-card {
    padding: 1.5rem;
  }
  
  .color-preview {
    width: 160px;
    height: 160px;
  }
  
  .gradient-preview {
    height: 200px;
  }
  
  .shadow-controls {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 768px) {
  .color-tool-container {
    padding: 0 1rem;
    margin: 1rem auto;
  }
  .shadow-preview-box {
      width:90%;
      margin: 0 auto;
  }
  
  .color-tool-card {
    padding: 1.2rem;
    border-radius: 16px;
  }
  
  .color-tabs {
    gap: 0.3rem;
    padding: 0.4rem;
  }
  
  .color-tab {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
    border-radius: 10px;
  }
  
  .color-tool-title {
    font-size: 1.6rem;
  }
  
  .color-preview {
    width: 140px;
    height: 140px;
    border-radius: 16px;
  }
  
  .color-values {
    grid-template-columns: 1fr;
  }
  
  .gradient-preview {
    height: 180px;
  }
  
  .stop-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }
  
  .stop-row input[type="color"] {
    width: 100%;
    height: 50px;
  }
  
  .stop-row button {
    align-self: center;
  }
  
  .shadow-controls {
    grid-template-columns: 1fr;
  }
  
  .shadow-preview-box {
    height: 160px;
  }
  
  .contrast-preview {
    flex-direction: column;
    align-items: stretch;
  }
  
  .contrast-sample {
    min-width: auto;
  }
  
  .accessibility-checker {
    padding: 1.2rem;
  }
  
  .image-upload-area {
    padding: 1.5rem 1rem;
  }
  
  .actions {
    flex-direction: column;
    align-items: center;
  }
  
  .action-btn {
    width: 100%;
    max-width: 300px;
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .color-tool-title {
    font-size: 1.4rem;
  }
  
  .color-tool-subtitle {
    font-size: 0.9rem;
  }
  
  .color-tab {
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
  }
  
  .color-preview {
    width: 120px;
    height: 120px;
  }
  
  .history-item {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  
  .gradient-preset {
    width: 40px;
    height: 40px;
  }
  
  .contrast-results {
    flex-direction: column;
  }
  
  .output-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .output-actions .action-btn {
    width: 100%;
  }
}

/* =========================
   TOAST NOTIFICATION
========================= */

@keyframes fadeInUp {
  from { 
    opacity: 0; 
    transform: translateX(-50%) translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0); 
  }
}

/* =========================
   PRINT STYLES
========================= */

@media print {
  .color-tool-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
  
  .color-tabs,
  .tool-btn,
  .action-btn,
  .image-upload-area,
  .clear-all,
  .imagesplit-related {
    display: none !important;
  }
  
  .color-tool-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .gradient-output pre {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
  }
}