/* General Styles */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  color: #2d3436;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
  background-color: #1a1a1a;
  color: #e0e0e0;
}

/* Header Styles */
header {
  background-color: #ffffff;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

body.dark-mode header {
  background-color: #2d2d2d;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

/* Logo Styles */
.logo {
  font-size: 24px;
  font-weight: bold;
}

header .logo img {
  height: 50px;
  width: auto;
}

/* Navigation Controls Container */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Home Button Styles */
.home-button {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #d32f2f;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s, transform 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.home-button:hover {
  background-color: #b71c1c;
  transform: scale(1.1);
}

.home-button i {
  font-size: 20px;
}

body.dark-mode .home-button {
  background-color: #d32f2f;
  color: white;
}

body.dark-mode .home-button:hover {
  background-color: #b71c1c;
}

/* Hamburger Menu Button */
.hamburger-menu {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 15px;
}

.hamburger-menu span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: #333;
  border-radius: 3px;
  transition: all 0.3s ease;
}

body.dark-mode .hamburger-menu span {
  background-color: #e0e0e0;
}

/* Hamburger Menu Animation */
.hamburger-menu.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

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

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

/* Mobile Menu Styles */
.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  right: 0;
  width: 250px;
  background-color: #ffffff;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 99;
  padding: 20px;
  border-radius: 0 0 0 10px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.mobile-menu.visible {
  display: block;
  transform: translateX(0);
}

.mobile-menu a {
  display: block;
  padding: 12px 15px;
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid #f1f1f1;
  transition: background-color 0.3s ease;
}

.mobile-menu a:hover {
  background-color: #f8f8f8;
}

body.dark-mode .mobile-menu {
  background-color: #2d2d2d;
}

body.dark-mode .mobile-menu a {
  color: #e0e0e0;
  border-bottom: 1px solid #3d3d3d;
}

body.dark-mode .mobile-menu a:hover {
  background-color: #3d3d3d;
}

/* Dark Mode Toggle Button */
#dark-mode-toggle {
  background: none;
  border: none;
  color: #333;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.3s ease;
  padding: 8px;
  border-radius: 50%;
}

body.dark-mode #dark-mode-toggle {
  color: #e0e0e0;
}

#dark-mode-toggle:hover {
  transform: scale(1.1);
  background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode #dark-mode-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Main Content Styles */
main {
  padding: 40px 20px;
  text-align: center;
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

/* Hero Section Styles */
.hero {
  padding: 1rem 1rem;
  background-color: #fff5f5;
  border-radius: 12px;
  margin-bottom: 1rem;
}

/* Feature Cards and Tool List Styles */
.features {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.feature-card {
  background-color: white;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  width: 20%; /* Adjusted width to fit 4 cards in one row */
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 200px;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.2);
}

.feature-icon {
  font-size: 2rem;
  color: #d32f2f;
  margin-bottom: 0.5rem;
}

.feature-card h2 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: #d32f2f;
}

.feature-card p {
  font-size: 0.9rem;
  color: #666;
}

/* Upload Section Styles */
.upload-section {
  background: #ffffff;
  padding: 15px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 30px;
  transition: all 0.3s ease;
  position: relative;
  min-height: 25px;
}

body.dark-mode .upload-section {
  background: #2d2d2d;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.upload-section:hover {
  transform: translateY(-2px);
}

/* Button Styles */
.tool-button, .file-input-button, .compression-button, .upload-button, .convert-button, .compress-button {
  background-color: #d32f2f;
  color: white;
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
  margin: 10px 5px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.tool-button:hover, .file-input-button:hover, .compression-button:hover, .upload-button:hover, .convert-button:hover, .compress-button:hover {
  background-color: #b71c1c;
  transform: translateY(-1px);
}

.tool-button:disabled, .file-input-button:disabled, .compression-button:disabled, .upload-button:disabled, .convert-button:disabled, .compress-button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* File Input Button Styles */
.file-input-button {
  max-width: 200px;
  width: 100%;
}

/* Label Styles */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #4a4a4a;
}

body.dark-mode label {
  color: #b0b0b0;
}

/* Progress Bar Styles */
.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  margin: 20px 0;
  overflow: hidden;
}

body.dark-mode .progress-bar {
  background-color: #3d3d3d;
}

.progress {
  height: 100%;
  width: 0%;
  background-color: #d32f2f;
  transition: width 0.3s ease;
}

/* Processing Icon Styles */
.processing-icon {
  margin: 20px 0;
}

.spinner {
  border: 4px solid rgba(211, 47, 47, 0.1);
  border-top: 4px solid #d32f2f;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

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

/* Preview Section Styles */
.preview-section {
  margin: 20px auto;
  max-width: 300px;
  padding: 0 10px;
  overflow-x: hidden;
}

.preview-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #f5f5f5;
  border-radius: 6px;
  padding: 8px;
}

#pdf-preview {
  border: 1px solid #ccc;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.preview-section ul {
  list-style-type: none;
  padding: 0;
}

#preview-section img {
  max-width: 300px;
  max-height: 300px;
  width: auto;
  height: auto;
  border-radius: 10px;
  margin: 10px 0;
}

/* File Info Styles */
.file-info {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  text-align: left;
}

body.dark-mode .file-info {
  background: #2d2d2d;
}

.file-info p {
  margin: 5px 0;
}

.filename {
  font-weight: 600;
  color: #d32f2f;
}

body.dark-mode .filename {
  color: #ff6b6b;
}

/* Error Message Styles */
.error-message {
  color: #d32f2f;
  margin: 10px 0;
  display: none;
  padding: 0 10px;
}

body.dark-mode .error-message {
  color: #ff6b6b;
}

/* Plus Button Styles */
.plus-button {
  background-color: #d32f2f;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  transition: background-color 0.3s, transform 0.3s;
}

.plus-button:hover {
  background-color: #b71c1c;
  transform: scale(1.1);
}

/* Footer Styles */
footer {
  text-align: center;
  padding: 20px;
  margin-top: auto;
  color: black;
  width: 100%;
}

body.dark-mode footer {
  background-color: #2d2d2d;
}

/* Responsive Styles */
@media (max-width: 768px) {
  main {
    padding: 20px 15px;
  }

  h1 {
    font-size: 2rem;
  }

  .upload-section {
    padding: 20px;
  }

  .file-input-button,
  .convert-button,
  .tool-button {
    padding: 12px 24px;
  }
}

@media (max-width: 480px) {
  header {
    padding: 10px 20px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .upload-section {
    padding: 15px;
  }
}