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

body { 
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(95deg, #5870f0 0%, #b252f5 100%);
  min-height: 100vh; 
  color: #333;
}

.main-bg {
  background: linear-gradient(95deg,  #5870f0 0%, #b252f5 100%);
}

/* Glass morphism effects */
.glass-bg { 
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.input-bg { 
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white; 
}

.input-bg::placeholder { 
  color: rgba(255, 255, 255, 0.7); 
}

select.input-bg { 
  appearance: none; 
  -webkit-appearance: none; 
  -moz-appearance: none; 
}

select.input-bg option { 
  background: #4c63d2; 
  color: white; 
}

.suggestion-list { 
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  color: #333;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.suggestion-list li { 
  padding: 0.75rem 1rem; 
  cursor: pointer; 
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.suggestion-list li:hover { 
  background: rgba(103, 126, 234, 0.1); 
}
     /* Calculator button  */
.btn-primary { 
  background: linear-gradient(135deg, #4041ff 0%, #5D1DF9 100%);
  color: white;
  transition: all 0.3s;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.result-bg { 
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.history-bg {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.unit-select { 
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.unit-select option { 
  background: #4c63d2; 
  color: white; 
}

.history-item {
  background: rgba(103, 126, 234, 0.1);
  border: 1px solid rgba(103, 126, 234, 0.2);
  transition: all 0.2s;
}

.history-item:hover {
  background: rgba(103, 126, 234, 0.2);
}

/* Atom icon animation */
.atom-icon {
  position: relative;
  width: 30px;
  height: 30px;
  margin-right: 8px;
}

.atom-icon::before,
.atom-icon::after,
.atom-icon .electron {
  content: '';
  position: absolute;
  border: 2px solid white;
  border-radius: 50%;
  width: 100%;
  height: 100%;
}

.atom-icon::before {
  transform: rotate(60deg) rotateX(60deg);
}

.atom-icon::after {
  transform: rotate(-60deg) rotateX(60deg);
}

.atom-icon .electron {
  transform: rotateX(60deg);
}

.atom-icon .nucleus {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

/* Favorite buttons */
.fav-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(58, 28, 133, 0.08);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  color: rgba(255,255,255,0.85);
}

.fav-btn:hover { 
  transform: scale(1.06);
}

.fav-btn.active {
  background: rgba(255, 213, 79, 0.25);
  border-color: rgba(255, 213, 79, 0.8);
  color: #ffd54f;
}

.fav-btn .material-icons {
  font-size: 18px;
  line-height: 1;
}

/* Search bar star button */
.search-fav-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(58, 16, 136, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
}

.search-fav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.1);
}

.search-fav-btn .material-icons {
  font-size: 16px;
}

/* Category headers in suggestions */
.category-header {
  background: rgba(103, 126, 234, 0.1);
  font-weight: bold;
  color: #4c63d2;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(103, 126, 234, 0.2);
}

.favorite-item {
  background: rgba(255, 213, 79, 0.1);
  border-left: 3px solid #ffd54f;
}

/* Navigation Styles */
.hamburger {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 8px;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hamburger span {
  width: 25px;
  height: 3px;
  background: #333;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.sidebar {
  position: fixed;
  top: 0;
  left: -300px;
  width: 300px;
  height: 100vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  z-index: 1000;
  transition: left 0.3s ease;
  padding: 80px 20px 20px;
}

.sidebar.active {
  left: 0;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 15px;
}

.sidebar-nav a {
  text-decoration: none;
  color: #333;
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 30px;
  cursor: pointer;
  color: #666;
}

/* Favorites Page Styles */
.favorites-page {
  background: white;
  border-radius: 20px;
  padding: 30px;
  margin: 20px;
  max-height: 80vh;
  overflow-y: auto;
}

.favorites-page h2 {
  color: #333;
  margin-bottom: 20px;
  font-size: 1.8rem;
  text-align: center;
}

.favorite-formula {
  background: #f8f9ff;
  padding: 20px;
  margin-bottom: 15px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  position: relative;
}

.favorite-formula h3 {
  color: #333;
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.favorite-formula .category {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.remove-fav-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(243, 210, 210, 0.742);
  border: 1px solid rgba(246, 246, 246, 0.3);
  color: #ff4444;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-fav-btn:hover {
  background: rgba(255, 0, 0, 0.2);
  transform: scale(1.1);
}

.no-favorites {
  text-align: center;
  color: #666;
  padding: 40px;
  font-size: 1.1rem;
}

.favorites-limit {
  background: rgba(255, 193, 7, 0.1);
  border: 1px solid rgba(255, 193, 7, 0.3);
  color: #856404;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 0.9rem;
}

/* Blog Page Styles */
.blog-page {
  background: white;
  border-radius: 20px;
  padding: 30px;
  margin: 20px;
  max-height: 80vh;
  overflow-y: auto;
}

.blog-page h2 {
  color: #333;
  margin-bottom: 30px;
  font-size: 1.8rem;
  text-align: center;
}

.blog-post {
  background: #f8f9ff;
  padding: 25px;
  margin-bottom: 20px;
  border-radius: 12px;
  border-left: 4px solid #667eea;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-post:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.blog-post h3 {
  color: #333;
  font-size: 1.3rem;
  margin-bottom: 10px;
  line-height: 1.4;
}

.blog-meta {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 15px;
  font-style: italic;
}

.blog-excerpt {
  color: #555;
  line-height: 1.6;
  margin-bottom: 15px;
  font-size: 0.95rem;
}

.blog-read-more {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.blog-read-more:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(103, 126, 234, 0.3);
}

/* Full Blog Post Styles */
.full-blog-post {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.full-blog-post h2 {
  color: #333;
  font-size: 2rem;
  margin-bottom: 10px;
  line-height: 1.3;
}

.full-blog-post .blog-meta {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.full-blog-post .blog-content {
  color: #444;
  line-height: 1.8;
  font-size: 1rem;
}

.full-blog-post .blog-content h3 {
  color: #333;
  font-size: 1.4rem;
  margin: 30px 0 15px;
}

.full-blog-post .blog-content h4 {
  color: #667eea;
  font-size: 1.2rem;
  margin: 25px 0 12px;
}

.full-blog-post .blog-content p {
  margin-bottom: 15px;
}

.full-blog-post .blog-content ul {
  margin: 15px 0;
  padding-left: 30px;
}

.full-blog-post .blog-content li {
  margin-bottom: 8px;
}

.full-blog-post .formula-box {
  background: #f0f4ff;
  border: 2px solid #667eea;
  border-radius: 10px;
  padding: 20px;
  margin: 20px 0;
  text-align: center;
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
}

.back-to-blog {
  background: #666;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.back-to-blog:hover {
  background: #555;
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .modal-content {
    padding: 20px;
    max-width: 95%;
    max-height: 95%;
  }
  
  .blog-page,
  .favorites-page {
    padding: 15px;
    margin: 10px;
  }
  
  .full-blog-post {
    padding: 10px;
  }
  
  .full-blog-post h2 {
    font-size: 1.5rem;
  }
}