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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

.site-header {
    background-color: #f7f7f7;
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo h1 {
    font-size: 28px;
    margin: 0;
}

.logo a {
    color: white;
    text-decoration: none;
}

.search-bar {
    position: relative;
    flex: 1;
    max-width: 500px;
}

#searchInput {
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    margin-top: 5px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    z-index: 1000;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-name {
    font-weight: 600;
    color: #2c3e50;
    display: block;
}

.search-result-desc {
    font-size: 14px;
    color: #666;
    display: block;
    margin-top: 2px;
}

.main-nav {
    background-color: #34495e;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    background-color: #2c3e50;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    list-style: none;
    z-index: 100;
}

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

.dropdown-menu li a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-menu li a:hover {
    background-color: #f8f9fa;
}

.menu-toggle {
  display: none;
  font-size: 26px;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
}

/* When viewport <= 768px */
@media (max-width: 768px) {
  .nav-menu {
    display: none; /* hide the menu */
    flex-direction: column;
    width: 100%;
    background-color: #34495e;
  }

  .nav-menu li {
    width: 100%;
  }

  .nav-menu > li > a {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .menu-toggle {
    display: block;
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
  }

  /* Dropdowns behave stacked on mobile */
  .dropdown-menu {
    position: static;
    background-color: #2c3e50;
    box-shadow: none;
    display: none;
  }

  .dropdown.open .dropdown-menu {
    display: block;
  }

  .nav-menu.active {
    display: flex;
  }
}

.main-content {
    min-height: calc(100vh - 400px);
    padding: 40px 0;
}

.hero-calculator-wrapper {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    align-items: center;
    margin-bottom: 40px;
}

.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 40px;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 0;
}

.hero-section h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.hero-section p {
    font-size: 20px;
    opacity: 0.95;
}

.featured-calculators h2,
.categories-section h2,
.all-calculators-section h2 {
    font-size: 32px;
    margin-bottom: 30px;
    color: #2c3e50;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.calculator-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    color: #333;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.calculator-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.calculator-card h3 {
    font-size: 18px;
    color: #2c3e50;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 50px;
}

.category-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.category-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.category-card p {
    color: #666;
}

.calculators-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.calculator-category {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.calculator-category h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.calculator-category ul {
    list-style: none;
}

.calculator-category ul li {
    margin-bottom: 10px;
}

.calculator-category ul li a {
    color: #2c3e50;
    text-decoration: none;
    display: block;
    padding: 8px 0;
    transition: color 0.2s;
}

.calculator-category ul li a:hover {
    color: #667eea;
}

.calc-desc {
    display: block;
    font-size: 13px;
    color: #666;
    margin-top: 3px;
}

.calculator-page {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 0 auto;
}

.calculator-page h1 {
    font-size: 36px;
    margin-bottom: 10px;
    color: #2c3e50;
}

.calculator-page .description {
    color: #666;
    margin-bottom: 30px;
    font-size: 18px;
}

.calculator-form {
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 14px;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.result-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.result-section h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: #2c3e50;
}

.result-item {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
}

.result-item strong {
    color: #667eea;
    display: inline-block;
    min-width: 180px;
}

.site-footer {
    background-color: #2c3e50;
    color: white;
    padding: 50px 0 20px;
    margin-top: 60px;
}

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

.footer-section h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #fff;
}

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

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

.footer-section ul li a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid #34495e;
    color: #bdc3c7;
}

.simple-calculator {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 0;
    width: 100%;
}

.simple-calculator h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

.calc-container {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.calc-display {
    width: 100%;
    padding: 20px;
    font-size: 28px;
    text-align: right;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.calc-buttons button {
    padding: 20px;
    font-size: 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-number {
    background: white;
    color: #2c3e50;
    border: 2px solid #ddd;
}

.btn-number:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.btn-operator {
    background: #3498db;
    color: white;
}

.btn-operator:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-equals {
    background: #27ae60;
    color: white;
}

.btn-equals:hover {
    background: #229954;
    transform: translateY(-2px);
}

.calc-buttons button:active {
    transform: translateY(0);
}

.matrix-input {
    margin-bottom: 20px;
}

.matrix-input label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.matrix-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.matrix-row input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.matrix-display {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    font-family: 'Courier New', monospace;
}

.matrix-display div {
    margin: 5px 0;
}

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

.fraction-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
}

.fraction-input {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fraction-input input {
    width: 100px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.fraction-input span {
    font-size: 24px;
    font-weight: bold;
}

.info-section {
    background: #e3f2fd;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
}

.info-section h2, .info-section h3 {
    color: #1976d2;
    margin-top: 20px;
}

.info-section h2:first-child {
    margin-top: 0;
}

.info-section ul {
    margin-left: 20px;
}

.info-section li {
    margin-bottom: 8px;
}

.result-item.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 20px;
}

.result-item.highlight strong {
    color: white;
}

.result-item.error {
    background: #ffebee;
    border-left: 4px solid #f44336;
    color: #d32f2f;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }
    
    .search-bar {
        max-width: 100%;
    }
    
    .nav-menu {
        flex-direction: column;
    }
    
    .dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        background-color: #2c3e50;
    }
    
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    .hero-calculator-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .hero-section {
        padding: 40px 20px;
    }
    
    .hero-section h1 {
        font-size: 32px;
    }
    
    .calculator-grid,
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .calculator-page {
        padding: 20px;
    }
    
    .simple-calculator {
        padding: 20px;
    }
    
    .calc-buttons button {
        padding: 15px;
        font-size: 18px;
    }
    
    .hero-search {
    margin: 20px auto;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-search input {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    outline: none;
    transition: 0.3s;
}

.hero-search input:focus {
    border-color: #1abc9c;
    box-shadow: 0 0 6px rgba(26, 188, 156, 0.3);
}

}
