/* Reset and Base Styles */
:root {
    --primary-color: #2563eb;
    --text-color: #1f2937;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --spacing-unit: 1rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--bg-color);
}

/* Header & Nav */
header {
    background-color: var(--card-bg);
    padding: var(--spacing-unit);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-unit);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.language-switcher {
    font-size: 0.875rem;
}

.lang-link {
    text-decoration: none;
    color: #6b7280;
    font-weight: 500;
}

.lang-link:hover {
    color: var(--primary-color);
}

.lang-link.active {
    color: var(--primary-color);
    font-weight: 700;
}

/* Search Bar */
.search-container {
    margin-bottom: var(--spacing-unit);
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tool-item.hidden {
    display: none;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    font-style: italic;
    display: none;
}

.no-results.visible {
    display: block;
}

/* Sitemap Section */
.sitemap-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.sitemap-section h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.sitemap-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
    list-style: none;
}

.sitemap-list a {
    text-decoration: none;
    color: #4b5563;
    font-size: 0.875rem;
}

.sitemap-list a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

nav ul {
    list-style: none;
    display: flex;
    gap: var(--spacing-unit);
}

nav a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Main Layout */
main {
    padding: var(--spacing-unit);
    max-width: 1200px;
    margin: 0 auto;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile first: single column */
    gap: var(--spacing-unit);
}

/* Responsive Grid for larger screens */
@media (min-width: 640px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tool Item Card */
.tool-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

details {
    width: 100%;
}

summary {
    padding: var(--spacing-unit);
    cursor: pointer;
    list-style: none;
    /* Hide default triangle in some browsers */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--primary-color);
}

details[open] summary::after {
    content: '-';
}

summary:hover {
    background-color: #f9fafb;
}

summary h2 {
    display: inline;
    font-size: 1rem;
}

.tool-content {
    padding: var(--spacing-unit);
    border-top: 1px solid var(--border-color);
}

.loading-indicator {
    font-style: italic;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
    margin-top: 2rem;
}