/* ===================================
   All-in-One Image Tools - Main Styles
   Professional, Responsive, AdSense-Ready
   =================================== */

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

/* CSS Variables for Theme */
:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-color: #ffffff;
  --bg-secondary: #f9fafb;
  --text-color: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1200px;
  --header-height: 70px;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-color: #111827;
  --bg-secondary: #1f2937;
  --text-color: #f9fafb;
  --text-secondary: #9ca3af;
  --border-color: #374151;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header Styles */
header {
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
}

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

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

nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

nav a {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.3s ease;
  position: relative;
}

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

nav a.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary-color);
}

/* Theme Toggle Button */
.theme-toggle {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.theme-toggle:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
}

/* Main Content */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 20px;
  min-height: calc(100vh - var(--header-height) - 200px);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-color) 100%);
  border-radius: var(--radius);
  margin-bottom: 60px;
  box-shadow: var(--shadow-lg);
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.2;
  color: var(--text-color);
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 30px;
}

.hero-cta {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 14px 32px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.hero-cta:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Tool Cards Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin: 40px 0;
}

.tool-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

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

.tool-card-icon {
  font-size: 3rem;
  margin-bottom: 20px;
}

.tool-card h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--text-color);
}

.tool-card p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.7;
}

.tool-card a {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.tool-card a:hover {
  background-color: var(--primary-hover);
}

/* Tool Interface Container */
.tool-container {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 40px;
  margin: 40px 0;
  box-shadow: var(--shadow-lg);
}

.tool-container h2 {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--text-color);
}

.tool-container .subtitle {
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-size: 1.05rem;
}

/* File Upload Area */
.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 50px 30px;
  text-align: center;
  background-color: var(--bg-color);
  transition: all 0.3s ease;
  cursor: pointer;
  margin-bottom: 30px;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--primary-color);
  background-color: var(--bg-secondary);
}

.upload-area-icon {
  font-size: 3rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 10px;
}

.upload-area small {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.file-input {
  display: none;
}

.upload-button {
  background-color: var(--primary-color);
  color: white;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
  margin-top: 15px;
}

.upload-button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

/* Tool Controls */
.tool-controls {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin: 30px 0;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.control-group select,
.control-group input[type="number"],
.control-group input[type="range"] {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 1rem;
  transition: all 0.3s ease;
}

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

.control-group input[type="range"] {
  cursor: pointer;
}

.slider-value {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Preview Area */
.preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  margin: 30px 0;
}

.preview-box {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.preview-box h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--text-color);
}

.preview-box img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  box-shadow: var(--shadow);
}

.file-info {
  text-align: left;
  background-color: var(--bg-secondary);
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-top: 15px;
}

.file-info p {
  margin: 5px 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 30px 0;
}

.btn {
  padding: 14px 30px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
}

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

.btn-secondary:hover {
  background-color: var(--border-color);
}

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

/* Article Section */
.article-section {
  margin: 60px 0;
}

.article-section h2 {
  font-size: 2rem;
  margin-bottom: 20px;
  color: var(--text-color);
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 10px;
}

.article-section h3 {
  font-size: 1.5rem;
  margin-top: 35px;
  margin-bottom: 15px;
  color: var(--text-color);
}

.article-section p {
  margin-bottom: 20px;
  line-height: 1.8;
  color: var(--text-color);
  font-size: 1.05rem;
}

.article-section ul,
.article-section ol {
  margin: 20px 0;
  padding-left: 30px;
}

.article-section li {
  margin-bottom: 12px;
  line-height: 1.7;
  color: var(--text-color);
}

.article-section strong {
  color: var(--primary-color);
  font-weight: 600;
}

/* FAQ Section */
.faq-section {
  margin: 60px 0;
  background-color: var(--bg-secondary);
  padding: 50px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.faq-section h2 {
  font-size: 2.2rem;
  margin-bottom: 40px;
  text-align: center;
  color: var(--text-color);
}

.faq-item {
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.faq-item:hover {
  box-shadow: var(--shadow);
}

.faq-question {
  padding: 20px 25px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--text-color);
  font-size: 1.05rem;
  user-select: none;
}

.faq-question:hover {
  background-color: var(--bg-secondary);
}

.faq-icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  color: var(--primary-color);
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding: 0 25px;
}

.faq-item.active .faq-answer {
  max-height: 500px;
  padding: 0 25px 20px;
}

.faq-answer p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 10px;
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  margin: 40px auto;
  background-color: var(--bg-secondary);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.form-group {
  margin-bottom: 25px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-color);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

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

.form-group textarea {
  resize: vertical;
  min-height: 150px;
}

.form-message {
  padding: 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: none;
}

.form-message.success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  display: block;
}

.form-message.error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  display: block;
}

/* Footer */
footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 40px 20px 20px;
  margin-top: 80px;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 30px;
}

.footer-section h4 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: var(--text-color);
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 10px;
}

.footer-section ul li a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-section ul li a:hover {
  color: var(--primary-color);
}

.footer-section p {
  color: var(--text-secondary);
  line-height: 1.7;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-container nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    box-shadow: var(--shadow-lg);
  }

  .header-container nav.active {
    display: flex;
  }

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

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-container {
    padding: 25px;
  }

  .preview-container {
    grid-template-columns: 1fr;
  }

  .faq-section {
    padding: 30px 20px;
  }

  .contact-form {
    padding: 25px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .article-section h2 {
    font-size: 1.6rem;
  }

  .article-section h3 {
    font-size: 1.3rem;
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-40 {
  margin-top: 40px;
}

.mb-40 {
  margin-bottom: 40px;
}

.hidden {
  display: none;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
