:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #ec4899;
    --secondary-glow: rgba(236, 72, 153, 0.4);
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --error: #ef4444;
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Atmospheric Background */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: var(--primary-glow);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
}

.blob-1 { top: -100px; left: -100px; background: var(--primary-glow); will-change: transform; }
.blob-2 { bottom: -100px; right: -100px; background: var(--secondary-glow); will-change: transform; }

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

header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

header p {
    margin-left: auto;
    margin-right: auto;
}

.lang-switcher {
    position: absolute;
    top: -20px;
    right: 0;
    display: flex;
    background: rgba(255, 255, 255, 0.02);
    padding: 3px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2), inset 0 0 10px rgba(255,255,255,0.02);
}

.lang-btn {
    padding: 8px 20px;
    border-radius: 100px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.lang-btn:hover {
    color: #fff;
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Search Bar - Hero Integration */
.search-wrapper {
    width: 100%;
    max-width: 650px;
    margin: -20px auto 50px; /* Pull up to join closer to header info */
    position: relative;
    z-index: 10;
}

.search-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    padding: 6px 6px 6px 30px;
    display: flex;
    align-items: center;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3), inset 0 0 20px rgba(255,255,255,0.02);
}

.search-container:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 30px 60px rgba(0,0,0,0.4), 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 1.1rem;
    flex: 1;
    padding: 14px 0;
    font-weight: 500;
}

.search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.search-icon {
    font-size: 1.3rem;
    margin-right: 20px;
    opacity: 0.4;
    filter: grayscale(1) brightness(2);
}

.clear-search {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.clear-search:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg) scale(1.1);
}

/* Category Filters - Premium Design */
.filter-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 50px;
}

.filter-container {
    background: rgba(30, 41, 59, 0.7); /* Solid fallback for Firefox if blur is disabled */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 8px;
    border-radius: 100px;
    display: flex;
    gap: 5px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3), inset 0 0 20px rgba(255,255,255,0.02);
    overflow-x: auto;
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

.filter-container::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

.filter-btn {
    background: transparent;
    border: none;
    padding: 12px 28px;
    border-radius: 100px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    position: relative;
}

.filter-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
    background: #4338ca; /* Darker indigo for better contrast (AA compliant) */
    color: #fff;
    box-shadow: 0 8px 20px rgba(67, 56, 202, 0.4);
    transform: translateY(-2px);
}

/* Tool Card Visibility */
.tool-card {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}

.tool-card.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8) translateY(20px);
}

header h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    margin-bottom: 10px;
}

header p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Glassmorphism Card Utility */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-premium);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* Tool Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.tool-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100%;
}

.tool-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-bottom: 5px;
}

.tool-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.tool-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    flex-grow: 1;
}

/* SEO Content Area */
.seo-section {
    margin-top: 80px;
    padding-top: 60px;
    border-top: 1px solid var(--glass-border);
}

.seo-content {
    max-width: 900px;
    margin: 0 auto;
}

.seo-content h2 { margin-bottom: 20px; font-size: 2rem; color: #fff; }
.seo-content h3 { margin: 30px 0 15px; font-size: 1.5rem; color: #fff; }
.seo-content h4 { margin: 25px 0 10px; font-size: 1.2rem; color: var(--text-muted); }
.seo-content p { margin-bottom: 20px; color: var(--text-muted); line-height: 1.8; }

.internal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.tag-link {
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.tag-link:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Footer */
footer {
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    header h1 { font-size: 2.2rem; }
    .tool-grid { grid-template-columns: 1fr; }
    
    .lang-switcher {
        top: -40px; /* Move up slightly on tablet to avoid header clashing */
        right: 10px;
    }
}

@media (max-width: 480px) {
    .container { padding: 30px 15px; }
    
    header { margin-bottom: 40px; }
    header h1 { font-size: 2rem; margin-top: 10px; }
    header p { font-size: 1rem; }
    
    .lang-switcher {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 30px;
        justify-content: center;
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
    }

    .search-wrapper { margin-bottom: 30px; }
    .search-input { font-size: 0.95rem; }
    
    .filter-container {
        padding: 6px 15px; /* Added horizontal padding so first/last items aren't cut off */
        justify-content: flex-start;
    }
    
    .filter-btn {
        padding: 10px 22px;
        font-size: 0.85rem;
    }

    .glass-card { padding: 20px; border-radius: 20px; }
}

/* ================================================
   GLOBAL BUTTON SYSTEM - Use across all tool pages
   ================================================ */

/* Primary Action Button - main tool actions */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 15px 35px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
}
.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px var(--primary-glow);
    filter: brightness(1.1);
}
.btn-primary:active {
    transform: translateY(0) scale(0.98);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: none;
}
.btn-primary.full-width { width: 100%; }

/* Ghost / Utility Button - secondary actions */
.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}
.btn-ghost:active { transform: translateY(0); }

/* Danger Button - destructive actions */
.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
}
.btn-danger:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* Size Variants */
.btn-sm { padding: 9px 18px; font-size: 0.85rem; border-radius: 10px; }
.btn-lg { padding: 18px 45px; font-size: 1.1rem; border-radius: 20px; }
 
 /* Error Message Style */
 .error-msg {
     color: #f87171;
     font-size: 0.85rem;
     padding: 12px 16px;
     background: rgba(239, 68, 68, 0.1);
     border-radius: 12px;
     border: 1px solid rgba(239, 68, 68, 0.2);
     display: none;
     margin-top: 15px;
     text-align: left;
 }
 .error-msg.show { display: block; }
 
 /* ================================================ */


/* ================================================
   NAVIGATION ENHANCEMENTS (Breadcrumbs & Sidebar)
   ================================================ */

/* Breadcrumbs */
.breadcrumb {
    margin-bottom: 30px;
    padding: 10px 0;
    font-size: 0.9rem;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.breadcrumb li:not(:last-child)::after {
    content: "›";
    font-size: 1.2rem;
    opacity: 0.5;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb li.active {
    color: var(--text-main);
    font-weight: 600;
}

/* Tool Layout Grid */
.tool-layout-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
    width: 100%;
}

/* Fallback for single column layout if sidebar is missing */
.tool-layout-wrapper:not(:has(aside)) {
    grid-template-columns: 1fr;
    max-width: 900px;
    margin: 0 auto;
}

/* Sidebar Navigation */
.tool-sidebar {
    position: sticky;
    top: 40px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    padding: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.tool-sidebar::-webkit-scrollbar { width: 4px; }
.tool-sidebar::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 2px solid var(--primary);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.sidebar-link.active {
    background: var(--primary-glow);
    color: #fff;
    font-weight: 600;
    border: 1px solid var(--glass-border);
}

/* Mobile Sidebar & Layout */
@media (max-width: 1024px) {
    .tool-layout-wrapper {
        grid-template-columns: 1fr;
    }
    
    .tool-sidebar {
        position: static;
        max-height: none;
        padding: 0;
        margin-bottom: 40px;
        order: 2; /* Move sidebar below main content on mobile */
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .sidebar-nav {
        grid-template-columns: 1fr;
    }
}
