/* McMaster-Carr Inspired Unified Styles */
@import url('https://fonts.googleapis.com/css2?family=Arial:wght@400;500;600;700&display=swap');

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

body {
  font-family: Arial, Helvetica, sans-serif;
  background-color: #ffffff;
  color: #333333;
  line-height: 1.4;
  font-size: 14px;
}

/* Header Section - Consistent Dark Green */
.header {
  background-color: #363;
  color: #ffffff;
  padding: 20px 0;
  border-bottom: 3px solid #fed700;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

.header h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #ffffff;
}

.header p {
  font-size: 16px;
  color: #e0e0e0;
  max-width: 800px;
  margin: 0 auto;
}

/* Navigation Tools Button */
.nav-links .nav-tools-button {
  background: #363 !important;
  color: white !important;
  border: none !important;
  padding: 8px 16px !important;
  border-radius: 4px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  text-decoration: none !important;
  vertical-align: middle !important;
}

.nav-links .nav-tools-button:hover {
  background: #444 !important;
  transform: translateY(-1px) !important;
  color: white !important;
}

.nav-links .nav-tools-button i:last-child {
  transition: transform 0.3s ease !important;
}

/* Active state for tools menu */
.tools-menu-active .nav-tools-button i:last-child {
  transform: rotate(180deg) !important;
}

/* Sidebar Overlay */
.tools-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 9998;
}

.tools-menu.active .tools-menu-overlay {
  opacity: 1;
  visibility: visible;
}

/* Sidebar Panel */
.tools-menu-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: #ffffff;
  box-shadow: -4px 0 30px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
  z-index: 10000;
  overflow-y: auto;
}

.tools-menu.active .tools-menu-sidebar {
  right: 0;
}

/* Sidebar Header */
.tools-menu-header {
  background: #363;
  color: white;
  padding: 25px 30px;
  border-bottom: 3px solid #fed700;
}

.tools-menu-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tools-menu-header p {
  margin: 8px 0 0 0;
  opacity: 0.9;
  font-size: 14px;
}

.tools-menu-close {
  position: absolute;
  top: 20px;
  right: 25px;
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  transition: opacity 0.2s ease;
}

.tools-menu-close:hover {
  opacity: 0.7;
}

/* Sidebar Content */
.tools-menu-content {
  padding: 0;
}

.tools-menu-category {
  margin-bottom: 20px;
}

.tools-menu-category-title {
  padding: 20px 30px 15px;
  background: #f8f9fa;
  font-weight: 700;
  color: #363;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0;
  border-bottom: 1px solid #e9ecef;
}

.tools-menu-item {
  display: block;
  padding: 18px 30px;
  color: #555;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  border-bottom: 1px solid #f0f0f0;
  position: relative;
}

.tools-menu-item:hover {
  background: #f8f9fa;
  color: #363;
  padding-left: 40px;
}

.tools-menu-item.active {
  background: #363;
  color: white;
  border-left: 4px solid #fed700;
}

.tools-menu-item.active:hover {
  background: #444;
  color: white;
}

.tools-menu-item i {
  margin-right: 15px;
  width: 20px;
  text-align: center;
  font-size: 18px;
}

/* Mobile Responsive for Tools Menu */
@media (max-width: 480px) {
  .tools-menu-sidebar {
    width: 100vw;
    right: -100vw;
  }

  .nav-links .nav-tools-button {
    padding: 6px 12px !important;
    font-size: 13px !important;
  }
}

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

/* Navigation Bar */
.nav-bar {
  background-color: #f5f5f5;
  border-bottom: 1px solid #e5e5e5;
  padding: 15px 0;
}

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

.nav-logo {
  font-size: 24px;
  font-weight: 700;
  color: #363;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 30px;
  list-style: none;
}

.nav-links a {
  color: #666;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #363;
}

/* Button Styling - McMaster style */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border: 1px solid;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.2;
}

.btn-primary {
  background-color: #363;
  border-color: #363;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #2a542a;
  border-color: #2a542a;
}

.btn-secondary {
  background-color: #fed700;
  border-color: #fed700;
  color: #333;
}

.btn-secondary:hover {
  background-color: #e6c200;
  border-color: #e6c200;
}

.btn-outline {
  background-color: #ffffff;
  border-color: #ccc;
  color: #333;
}

.btn-outline:hover {
  background-color: #f5f5f5;
  border-color: #999;
}

.btn-large {
  padding: 15px 30px;
  font-size: 16px;
  font-weight: 600;
}

.w-100 {
  width: 100%;
}

/* Tool Cards for Main Page */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.tool-card {
  background-color: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  padding: 30px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
}

.tool-card-link:hover .tool-card {
  border-color: #363;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
}

.tool-card.featured {
  border-color: #fed700;
  background-color: #fffbf0;
}

.tool-icon {
  font-size: 48px;
  color: #363;
  margin-bottom: 20px;
}

.tool-card.featured .tool-icon {
  color: #fed700;
}

.tool-card h3 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 15px;
}

.tool-card p {
  font-size: 14px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 0;
  text-align: left;
}

.tool-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  width: 100%;
}

.tool-card-link:hover {
  text-decoration: none;
  color: inherit;
}

.featured-badge {
  position: absolute;
  top: -10px;
  right: 15px;
  background-color: #fed700;
  color: #333;
  padding: 5px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Form Elements */
.form-control {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.4;
  color: #333;
  background-color: #fff;
  background-image: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
  border-color: #363;
  outline: 0;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 0 3px rgba(54, 54, 51, .1);
}

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

.form-label {
  display: inline-block;
  max-width: 100%;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

/* Sections and Cards */
.section {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  margin-bottom: 30px;
  padding: 30px;
}

.section-header {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

.section-header h2 {
  font-size: 28px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.section-header p {
  font-size: 16px;
  color: #666;
  max-width: 600px;
  margin: 0 auto;
}

.card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  margin-bottom: 20px;
}

.card-header {
  background: #f8f9fa;
  border-bottom: 1px solid #e5e5e5;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.feature-item {
  text-align: center;
  padding: 20px;
}

.feature-icon {
  font-size: 36px;
  color: #363;
  margin-bottom: 15px;
}

.feature-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
  margin-bottom: 10px;
}

.feature-description {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

/* Footer */
.footer {
  background-color: #363;
  color: #ffffff;
  text-align: center;
  padding: 30px 0;
  margin-top: 60px;
}

.footer p {
  font-size: 14px;
  color: #e0e0e0;
}

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

.mb-10 { margin-bottom: 10px; }
.mb-15 { margin-bottom: 15px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mb-40 { margin-bottom: 40px; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mt-40 { margin-top: 40px; }

.primary-color { color: #363; }
.text-muted { color: #666; }

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e5e5;
}

.data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #333;
}

/* Loading Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.6s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header h1 {
    font-size: 28px;
  }

  .header p {
    font-size: 14px;
  }

  .container {
    padding: 20px 15px;
  }

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

  .tool-card {
    padding: 20px;
  }

  .nav-content {
    flex-direction: column;
    gap: 15px;
  }

  .nav-links {
    gap: 20px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .tool-icon {
    font-size: 36px;
  }

  .section-header h2 {
    font-size: 24px;
  }

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

/* Universal icon spacing fixes to prevent text overlap on all pages */
.fas, .far, .fab,
i[class*="fa"] {
  margin-right: 10px !important;
  display: inline-block !important;
}

/* Exceptions for decorative icons that don't need spacing */
.fas.fa-arrows-alt-h,
i[class*="fa"].fa-arrows-alt-h,
i[style*="color"] {
  margin-right: 0 !important;
}

/* Mobile responsiveness for icon spacing */
@media (max-width: 768px) {
  .fas, .far, .fab,
  i[class*="fa"] {
    margin-right: 12px !important;
    font-size: 0.9em;
  }

  .fas.fa-arrows-alt-h,
  i[class*="fa"].fa-arrows-alt-h,
  i[style*="color"] {
    margin-right: 0 !important;
  }

  /* Ensure headers display properly on mobile */
  h1, h3, h4, h5,
  .section-header,
  .card-header h3 {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
  }

  /* Ensure proper spacing for small screens */
  @media (max-width: 480px) {
    .fas, .far, .fab,
    i[class*="fa"] {
      margin-right: 8px !important;
      font-size: 0.8em;
    }

    .fas.fa-arrows-alt-h,
    i[class*="fa"].fa-arrows-alt-h,
    i[style*="color"] {
      margin-right: 0 !important;
    }
  }
}

/* Request Tool Page Styles */
.request-tool-section {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    align-items: start;
}

.request-form-card {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 40px;
    border: 1px solid #e5e5e5;
}

.request-info-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 30px;
    border: 1px solid #e9ecef;
    position: sticky;
    top: 20px;
}

.request-info-card h3 {
    color: #363;
    margin-bottom: 25px;
    font-size: 18px;
}

.guideline-section {
    margin-bottom: 25px;
}

.guideline-section h4 {
    color: #363;
    font-size: 16px;
    margin-bottom: 10px;
}

.guideline-section ul {
    margin: 0;
    padding-left: 20px;
}

.guideline-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

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

.form-label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-label i {
    margin-right: 8px;
    color: #363;
    width: 16px;
}

.form-help {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.btn-submit {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    width: auto;
    min-width: 200px;
}

.btn-submit i {
    margin-right: 8px;
}

/* Alert Styles for Request Tool */
.alert {
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid;
}

.alert h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.alert-success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

@media (max-width: 768px) {
    .request-tool-section {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .request-form-card {
        padding: 30px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .request-info-card {
        position: static;
    }
}

/* High Contrast Result/Output Boxes - Global Improvement */
.result-grid,
.conversion-result,
.output-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.result-item,
.conversion-item,
.output-item {
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #4facfe;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-item:hover,
.conversion-item:hover,
.output-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #fed700;
}

.result-item strong,
.conversion-item strong,
.output-item strong {
    display: block;
    color: #363;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-value,
.size-value,
.output-value {
    font-size: 28px;
    font-weight: bold;
    color: #363 !important;
    text-shadow: none !important;
}

/* Error display improvements */
.error-message,
#errorContent {
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #ff4444;
    color: #721c24 !important;
    font-weight: 600;
}

/* Success display improvements */
.success-message {
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #00ff88;
    color: #155724 !important;
    font-weight: 600;
}

/* Info boxes improvements */
.canvas-info,
.info-box {
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-top: 15px;
    border: 2px solid #4facfe;
    color: #333 !important;
}

.canvas-info p,
.info-box p {
    margin: 0;
    color: #333 !important;
    font-weight: 500;
}

/* Ensure good contrast on all gradient backgrounds */
.main-content {
    color: #fff;
}

.main-content .card {
    color: #333;
}

/* Template items and guideline items improvements */
.template-item,
.guideline-item {
    background: rgba(255, 255, 255, 0.95) !important;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333 !important;
}

.template-item h4,
.guideline-item h4 {
    color: #363 !important;
    margin-bottom: 10px;
}

.template-item p,
.guideline-item p,
.template-item li,
.guideline-item li {
    color: #333 !important;
    line-height: 1.6;
}

/* Mobile responsive for high contrast */
@media (max-width: 768px) {
    .result-item,
    .conversion-item,
    .output-item {
        padding: 15px;
    }

    .result-value,
    .size-value,
    .output-value {
        font-size: 24px;
    }
}