* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #B0DB9C;
    --secondary-color: #8fc77d;
    --primary-dark: #7ab566;
    --background-color: #f8fafc;
    --sidebar-bg: #fff;
    --main-bg: #f8fafc;
    --card-bg: #fff;
    --text-color: #1e293b;
    --muted-text: #64748b;
    --border-radius: 16px;
    --shadow: 0 4px 24px rgba(176, 219, 156, 0.15);
    --transition: all 0.2s cubic-bezier(.4,0,.2,1);
    --badge-featured: #B0DB9C;
    --badge-trending: #fbbf24;
    --badge-paid: #f87171;
    --badge-freemium: #34d399;
    --badge-beta: #a78bfa;
    --input-bg: #fff;
    --input-border: #e2e8f0;
    --tag-bg: #f1f5f9;
    --sidebar-about-bg: #f1f5f9;
    --footer-bg: #1e293b;
    --footer-text: #e2e8f0;
    --footer-link: #B0DB9C;
}

[data-theme="dark"] {
    --primary-color: #8fc77d;
    --secondary-color: #B0DB9C;
    --primary-dark: #7ab566;
    --background-color: #0f172a;
    --sidebar-bg: #1e293b;
    --main-bg: #0f172a;
    --card-bg: #1e293b;
    --text-color: #e2e8f0;
    --muted-text: #94a3b8;
    --shadow: 0 4px 24px rgba(176, 219, 156, 0.1);
    --input-bg: #1e293b;
    --input-border: #334155;
    --tag-bg: #334155;
    --sidebar-about-bg: #334155;
    --footer-bg: #0f172a;
    --footer-text: #e2e8f0;
    --footer-link: #B0DB9C;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    overflow-y: auto; /* Enable vertical scrolling for the body */
    width: 100%;
    max-width: 100%;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Enhanced theme transition styles */
.theme-transitioning * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

/* Theme toggle button enhanced styles */
.theme-toggle {
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(176, 219, 156, 0.4);
}

.theme-toggle i {
    transition: transform 0.3s ease;
}

/* My Tools Section Styles */
.tools-section {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 24px;
    margin: 32px 0;
    border: 1px solid var(--input-border);
    transition: var(--transition);
}

.tools-section h2 {
    font-size: 1.6rem;
    margin-bottom: 18px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tools-list {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    margin-bottom: 16px;
    min-height: 80px;
}

.tool-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    padding: 8px;
    border-radius: 12px;
}

.tool-item:hover {
    background: var(--tag-bg);
    transform: translateY(-2px);
}
.tool-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f4f4f4;
    object-fit: contain;
    margin-bottom: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.tool-name {
    font-size: 0.95rem;
    color: #222;
    text-align: center;
    margin-bottom: 2px;
}
.edit-btn {
    background: #f5f5f5;
    border: none;
    color: #222;
    font-size: 1rem;
    padding: 6px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    float: right;
}
.edit-btn:hover {
    background: #e0e0e0;
}

/* Tool Edit and Delete Button Styles */
.tool-edit, .tool-delete {
  position: absolute;
  top: 4px;
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-color);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 2;
  line-height: 1;
}

.tool-edit {
  right: 60px;
  background: var(--primary-color);
  color: var(--text-color);
}

.tool-delete {
  right: 4px;
  background: #ef4444;
  color: white;
  border-color: #dc2626;
}

.tool-edit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(176, 219, 156, 0.3);
}

.tool-delete:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}
/* Modal Styles */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  min-width: 400px;
  max-width: 90vw;
  position: relative;
  border: 1px solid var(--input-border);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from { 
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 24px;
  color: var(--text-color);
  font-size: 1.4rem;
  font-weight: 600;
}

.modal-content label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.9rem;
}

.modal-content input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-color);
  font-size: 1rem;
  transition: var(--transition);
  box-sizing: border-box;
}

.modal-content input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(176, 219, 156, 0.1);
}

/* Auto Logo Fetch additions */
.icon-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: -8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.fetch-logo-btn {
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: var(--transition);
}
.fetch-logo-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}
.icon-hint {
    font-size: 0.7rem;
    color: var(--muted-text);
}
.icon-preview {
    width: 72px;
    height: 72px;
    border: 1px dashed var(--input-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.icon-preview img { width: 100%; height: 100%; object-fit: contain; }
.icon-preview-placeholder { font-size: 0.65rem; color: var(--muted-text); text-align:center; padding:4px; }
.icon-preview.loading::after { content: 'Fetching...'; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:0.65rem; backdrop-filter: blur(2px); background:rgba(255,255,255,0.6); color:#333; }
[data-theme="dark"] .icon-preview.loading::after { background:rgba(0,0,0,0.4); color: var(--text-color); }
[data-theme="dark"] .icon-preview { border-color: var(--input-border); }


.modal-content button[type="submit"] {
  background: var(--primary-color);
  color: var(--text-color);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition);
  width: 100%;
  box-shadow: 0 2px 8px rgba(176, 219, 156, 0.3);
}

.modal-content button[type="submit"]:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(176, 219, 156, 0.4);
}

.close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 1.5rem;
  color: var(--muted-text);
  cursor: pointer;
  transition: var(--transition);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.close:hover {
  background: var(--tag-bg);
  color: var(--text-color);
}

/* Dark mode specific enhancements for My Tools */
[data-theme="dark"] .tools-section {
  border-color: var(--input-border);
  background: var(--card-bg);
}

[data-theme="dark"] .tool-icon {
  background: var(--sidebar-bg);
  border: 1px solid var(--input-border);
}

[data-theme="dark"] .modal {
  background: rgba(0,0,0,0.8);
}

[data-theme="dark"] .modal-content {
  border-color: var(--input-border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

[data-theme="dark"] .tool-edit,
[data-theme="dark"] .tool-delete {
  background: var(--sidebar-bg);
  border-color: var(--input-border);
  color: var(--text-color);
}

[data-theme="dark"] .tool-edit {
  background: var(--primary-color);
  color: var(--text-color);
}

[data-theme="dark"] .tool-delete {
  background: #ef4444;
  color: white;
  border-color: #dc2626;
}/* Custom Scrollbar Styles */
/* For WebKit browsers (Chrome, Safari) */
::-webkit-scrollbar {
    width: 10px; /* width of the scrollbar */
}

::-webkit-scrollbar-track {
    background: var(--main-bg); /* Color of the tracking area */
    border-radius: 10px; /* Rounded corners for the track */
}

::-webkit-scrollbar-thumb {
    background: #000; /* Color of the scroll thumb */
    border-radius: 10px; /* Rounded corners for the thumb */
    border: 2px solid var(--main-bg); /* Space around thumb */
}

/* For Firefox */
html {
    scrollbar-width: thin; /* "auto" or "thin" */
    scrollbar-color: #000 var(--main-bg); /* thumb color track color */
}

.layout {
    display: flex;
    background: var(--main-bg);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    box-shadow: 2px 0 16px rgba(0,0,0,0.04);
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto; /* Allow internal scrolling for sidebar content */
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 20px 0px 20px;
}

.sidebar-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0;
    margin-top: 10px;
}

.sidebar-categories h3,
.sidebar-about h3 {
    font-size: 1rem;
    margin-bottom: 0;
    color: var(--muted-text);
    font-weight: 600;
}

.sidebar-categories ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar-categories li {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.25rem;
    cursor: pointer;
    color: var(--text-color);
    transition: var(--transition);
    font-size: 1rem;
}
.sidebar-categories li.active,
.sidebar-categories li:hover {
    background: var(--primary-color);
    color: #fff;
}

.sidebar-about {
    font-size: 0.95rem;
    color: var(--text-color);
    background: var(--sidebar-about-bg);
    border-radius: var(--border-radius);
    padding: 1.2rem;
    margin-top: auto;
    border: 1px solid var(--input-border);
}

.sidebar-about h3 {
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.sidebar-about p {
    line-height: 1.6;
    margin: 0;
    color: var(--text-color);
    opacity: 0.9;
}

.sidebar-about .copyright {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--input-border);
    font-size: 0.85rem;
    color: var(--muted-text);
    text-align: center;
}

.main-content {
    flex: 1;
    padding: 2.5rem 2rem 2rem 2rem;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    width: 100%;
}

.main-header {
    margin-bottom: 2rem;
}
.main-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    width: 100%;
    flex-wrap: wrap;
}
.header-content {
    flex: 1;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}
.main-header-top h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-weight: 500;
    opacity: 0.9;
    border-left: 4px solid var(--primary-color);
    padding-left: 1.2rem;
    margin-left: -1.2rem;
}

.header-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--muted-text);
    font-weight: 500;
}

.tools-counter {
    color: var(--muted-text);
    font-size: 1rem;
    padding-top: 0.5rem;
    background: var(--tag-bg);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.main-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.2rem;
    width: 100%;
    flex-wrap: wrap;
}
.search-container {
    position: relative;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
}
.search-container input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--input-border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--input-bg);
    color: var(--text-color);
    transition: var(--transition);
}
.search-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(176, 219, 156, 0.2);
}
.search-container i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a1a1aa;
}
#sortSelect {
    padding: 0.7rem 1.2rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
    transition: var(--transition);
    box-sizing: border-box;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.featured-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0;
}

.view-options {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    background: var(--tag-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted-text);
    transition: var(--transition);
}

.view-btn:hover, .view-btn.active {
    background: var(--primary-color);
    color: white;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.tools-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.empty-state {
    display: none;
    text-align: center;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: 8px;
    margin: 2rem 0;
    box-shadow: var(--card-shadow);
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border-color);
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner h2 {
    margin-top: 1rem;
    color: var(--text-color);
    font-size: 1.5rem;
}

.tool-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

/* List view styles */
.tools-grid.list-view {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.tools-grid.list-view .tool-card {
    flex-direction: row;
    align-items: flex-start;
    padding: 1rem;
}

.tools-grid.list-view .tool-header {
    flex: 0 0 80px;
    margin-right: 1.5rem;
    flex-direction: column;
    align-items: center;
}

.tools-grid.list-view .tool-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tools-grid.list-view .tool-logo {
    width: 60px;
    height: 60px;
    margin-right: 0;
    margin-bottom: 0.5rem;
}

.tools-grid.list-view .tool-name {
    font-size: 1rem;
    text-align: center;
    margin: 0;
}

.tools-grid.list-view .tool-badges {
    margin-bottom: 0.5rem;
}

.tools-grid.list-view .tool-description {
    margin-bottom: 1rem;
}

.tools-grid.list-view .tags-container {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tools-grid.list-view .tool-tags {
    margin-right: 0.5rem;
}

.tools-grid.list-view .tool-footer {
    margin-top: auto;
}

.tools-grid.list-view .tool-card {
    flex-direction: row;
    align-items: flex-start;
    min-height: 120px;
    gap: 1.5rem;
}

.tools-grid.list-view .tool-header {
    width: 200px;
    flex-shrink: 0;
}

.tools-grid.list-view .tool-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tools-grid.list-view .tool-description {
    -webkit-line-clamp: 2;
}

.tools-grid.list-view .tool-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}
.tool-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px;
    background: #f1f5f9;
    margin-bottom: 0.3rem;
}
.tool-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.tool-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}
.tool-badges {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}
.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    color: #fff;
    background: var(--primary-color);
    display: inline-block;
    margin-bottom: 0.1rem;
}
.badge.featured { background: var(--badge-featured); }
.badge.trending { background: var(--badge-trending); color: #fff; }
.badge.paid { background: var(--badge-paid); }
.badge.freemium { background: var(--badge-freemium); }

.tool-description {
    color: var(--muted-text);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}
.tag {
    background: var(--tag-bg);
    color: var(--muted-text);
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    display: inline-block;
}
.tool-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
    margin-top: 0.5rem;
}

.tool-link:hover {
    background: var(--primary-dark);
}

/* Loading Animation */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(176, 219, 156, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 500;
}

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition), transform 0.3s ease;
    box-shadow: 0 4px 16px rgba(176, 219, 156, 0.2);
    z-index: 100;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1.2rem;
    left: 1.2rem;
    z-index: 1300;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 12px;
    width: 54px;
    height: 54px;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(176, 219, 156, 0.2);
    transition: var(--transition), transform 0.3s ease;
    padding: 0;
}
.sidebar-toggle:active {
    background: var(--secondary-color);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

.sidebar-overlay.active {
    display: block;
}

/* Footer Styles */
.site-footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    padding: 3rem 2rem 1.5rem;
    margin-top: 3rem;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 0 1rem;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: var(--footer-text);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.9rem;
}

.footer-section ul li a:hover {
    color: var(--footer-link);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    color: var(--footer-text);
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--footer-link);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
}

/* Media Queries */
@media (max-width: 1200px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        width: 280px;
        max-width: 85vw;
        overflow-y: auto;
    }
    
    .sidebar.open {
        left: 0;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .search-container {
        width: 100%;
        margin-top: 1rem;
    }
    
    .sort-container {
        margin-top: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .view-options {
        margin-top: 1rem;
    }
    
    .tools-grid.list-view .tool-card {
        flex-direction: column;
    }
    
    .tools-grid.list-view .tool-header {
        flex: none;
        margin-right: 0;
        margin-bottom: 1rem;
        flex-direction: row;
    }
    
    .tools-grid.list-view .tool-logo {
        margin-right: 1rem;
        margin-bottom: 0;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .header-stats {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }
    
    .stat-item {
        flex: 1;
        text-align: center;
        margin-bottom: 0;
    }
    
    .main-header-top h1 {
        font-size: 1.5rem;
        width: 100%;
    }
    
    .subtitle {
        width: 100%;
        box-sizing: border-box;
    }
    
    .tools-counter {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        margin-top: 0.5rem;
    }
    
    .search-container {
        width: 100%;
    }
    
    #sortSelect {
        width: 100%;
    }
    
    /* Ensure fixed buttons are properly positioned on mobile */
    .sidebar-toggle,
    .back-to-top,
    .theme-toggle {
        will-change: transform;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    /* Adjust spacing between fixed buttons */
    .theme-toggle {
        bottom: 5.5rem;
    }
    
    .back-to-top {
        bottom: 9rem;
    }
}

/* Footer Styles */
.site-footer {
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    padding: 0 1.5rem;
}

.footer-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
    color: var(--heading-color);
    position: relative;
}

.footer-section h3:after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 40px;
    height: 3px;
    background-color: var(--primary);
}

.footer-section p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-section ul li {
    margin-bottom: 0.8rem;
}

.footer-section ul li a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
}

.footer-section ul li a:hover {
    color: var(--primary);
}

.footer-section ul li a i {
    margin-right: 0.5rem;
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.2s;
}

.social-links a:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-muted);
}

@media (max-width: 700px) {
    .main-content {
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        width: 100%;
    }
    .main-header-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    .search-container {
        width: 100%;
    }
    #sortSelect {
        width: 100%;
    }
    .tool-card {
        padding: 0.8rem;
        min-height: 180px;
    }
    .tool-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }
    .tool-logo {
        width: 28px;
        height: 28px;
        margin-bottom: 0;
    }
    .tool-name {
        font-size: 0.95rem;
    }
    .tool-badges {
        gap: 0.2rem;
    }
    .badge {
        font-size: 0.65rem;
        padding: 0.12rem 0.4rem;
    }
    .tool-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        margin-bottom: 0.2rem;
    }
    .tool-tags {
        gap: 0.2rem;
        margin-bottom: 0.2rem;
    }
    .tag {
        font-size: 0.65rem;
        padding: 0.12rem 0.4rem;
    }
    .tool-link {
        width: 100%;
        text-align: center;
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }
    .main-header-top h1 {
        font-size: 1.5rem;
        margin-bottom: 0.4rem;
    }
    .subtitle {
        font-size: 0.9rem;
        padding-left: 0.6rem;
        margin-left: -0.6rem;
        border-left-width: 2px;
    }
    #toolCount {
        font-size: 0.8rem;
    }
    .featured-title {
        font-size: 1rem;
        margin-bottom: 0.8rem;
    }
    .sidebar {
        width: 100%;
        max-width: 250px;
        padding: 0.6rem;
    }
    .sidebar-header {
        flex-direction: row;
        align-items: center;
        gap: 0.3rem;
        padding: 0;
        margin-bottom: 0.4rem;
    }
    .sidebar-header h2 {
        font-size: 1.4rem;
        margin-top: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .logo {
        max-height: 30px;
        flex-shrink: 0;
    }
    .sidebar-categories {
        margin-bottom: 0.6rem;
    }
    .sidebar-categories h3,
    .sidebar-about h3 {
        font-size: 1.05rem;
        margin-bottom: 0.2rem;
    }
    .sidebar-categories ul {
        padding: 0;
        margin: 0;
    }
    .sidebar-categories li {
        padding: 0.5rem 1rem;
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
        line-height: 1.6;
        word-wrap: break-word;
    }
    .sidebar-about {
        padding: 1.2rem;
    }
    .sidebar-about p {
        font-size: 1.1rem;
        line-height: 1.6;
    }
    .copyright {
        font-size: 0.65rem;
    }
    .back-to-top {
        right: 0.8rem;
        bottom: 0.8rem;
        width: 36px;
        height: 36px;
        will-change: transform;
    }
    .theme-toggle {
        right: 0.8rem;
        bottom: 4.5rem;
        width: 36px;
        height: 36px;
        will-change: transform;
    }
    .theme-toggle i {
        font-size: 0.9rem;
    }
    .search-container input {
        padding: 0.5rem 0.8rem 0.5rem 2.2rem;
        font-size: 0.9rem;
    }
    #sortSelect {
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
    }
    .main-header {
        margin-bottom: 1.2rem;
    }
    .main-header-top {
        margin-bottom: 1.2rem;
    }
    .main-header-actions {
        margin-top: 0.8rem;
        gap: 0.8rem;
    }
    .tools-grid {
        margin-top: 0.8rem;
    }
    .sidebar-toggle {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
        top: 0.8rem;
        left: 0.8rem;
    }
}

/* Add smooth scrolling for mobile */
@media (max-width: 700px) {
    html {
        scroll-behavior: smooth;
    }
}

/* Improve touch targets for mobile */
@media (max-width: 700px) {
    .sidebar-categories li,
    .tool-link,
    .search-container input,
    #sortSelect {
        min-height: 40px;
    }
}

/* Add better spacing for mobile */
@media (max-width: 700px) {
    .main-header {
        margin-bottom: 1.5rem;
    }
    .main-header-top {
        margin-bottom: 1.5rem;
    }
    .main-header-actions {
        margin-top: 1rem;
    }
    .tools-grid {
        margin-top: 1rem;
    }
}

.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition), transform 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle i {
    font-size: 1.2rem;
}

.sidebar-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px; /* Adjust as needed for vertical space */
  margin-bottom: 12px;
}

.logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 50%; /* Optional: makes it circular */
  background: #fff;   /* Optional: white background for contrast */
  box-shadow: 0 2px 8px rgba(0,0,0,0.06); /* Optional: subtle shadow */
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
} 

/* Submission Form Styles */
.submission-section {
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 16px;
    padding: 32px 28px 36px;
    margin: 48px 0 24px;
    box-shadow: var(--shadow);
    position: relative;
}
.submission-section h2 {
    margin-top: 0;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 12px;
}
.submission-intro {
    margin: 0 0 28px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--muted-text);
    max-width: 760px;
}
.submission-form {
    display: flex;
    flex-direction: column;
    gap: 26px;
}
.submission-form .form-row {
    display: flex;
    flex-direction: column;
    position: relative;
}
.submission-form label {
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: var(--text-color);
}
.submission-form input[type="text"],
.submission-form input[type="url"] {
    padding: 14px 16px;
    border: 1.5px solid var(--input-border);
    background: var(--input-bg);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-color);
    transition: var(--transition);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.submission-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(176,219,156,0.15);
}
.field-hint {
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--muted-text);
    letter-spacing: .3px;
}
.field-error {
    margin-top: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #dc2626;
    min-height: 14px;
    letter-spacing: .3px;
}
.submission-form input.error {
    border-color: #dc2626;
    background: rgba(220,38,38,0.05);
}
.form-actions {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.submit-btn, .reset-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: .4px;
    padding: 14px 22px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    position: relative;
}
.submit-btn {
    background: var(--primary-color);
    color: var(--text-color);
    box-shadow: 0 4px 14px -2px rgba(176,219,156,0.4);
}
.submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px -2px rgba(176,219,156,0.45);
}
.submit-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}
.reset-btn {
    background: var(--tag-bg);
    color: var(--text-color);
}
.reset-btn:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
}
.form-status {
    margin-top: 10px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted-text);
    min-height: 16px;
}
.form-status.success { color: #15803d; }
.form-status.error { color: #dc2626; }

@media (max-width: 700px) {
    .submission-section { padding: 28px 22px 32px; margin: 40px 0 16px; }
    .submission-section h2 { font-size: 1.5rem; }
    .submission-form { gap: 22px; }
    .submit-btn, .reset-btn { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 700px) {
  .sidebar-logo-container {
    width: 56px;
    height: 56px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    overflow: hidden;
  }
  .logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
  }
}
