/* Global resets and layout styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

img {
    max-width: 100%;
    height: auto;
}

/* Screen Readers Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Containers */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto 30px;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: var(--max-width-narrow);
}

/* Header */
.header {
    height: var(--header-height);
    background-color: var(--color-header-bg);
    border-bottom: 1px solid var(--color-header-border);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.45rem;
    text-decoration: none;
    user-select: none;
    padding: 0.2rem 0;
    transition: transform 0.3s ease;
}

.brand-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.16) 0%, rgba(56, 189, 248, 0.12) 50%, rgba(192, 132, 252, 0.16) 100%);
    border: 1px solid rgba(129, 140, 248, 0.35);
    box-shadow: 0 4px 16px -2px rgba(99, 102, 241, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-icon {
    transform: translateY(-2px) scale(1.08) rotate(-4deg);
    border-color: rgba(56, 189, 248, 0.8);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.28) 0%, rgba(56, 189, 248, 0.22) 50%, rgba(236, 72, 153, 0.25) 100%);
    box-shadow: 0 8px 24px -2px rgba(56, 189, 248, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.5);
}

.brand-text {
    display: inline-flex;
    align-items: center;
    font-weight: 800;
    letter-spacing: -0.035em;
    font-size: 1.55rem;
    line-height: 1;
}

.brand-name-light {
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 45%, #d1fae5 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #ffffff;
    font-weight: 800;
    filter: drop-shadow(0 2px 6px rgba(255, 255, 255, 0.18));
    transition: filter 0.3s ease, background-position 0.5s ease;
}

.brand:hover .brand-name-light {
    background-position: right center;
    filter: drop-shadow(0 0 10px rgba(52, 211, 153, 0.45));
}

.brand-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 0.2rem;
    padding: 0.12rem 0.38rem;
    min-width: 1.35em;
    height: 1.35em;
    font-size: 0.78em;
    font-weight: 900;
    line-height: 1;
    color: #ffffff;

    background: linear-gradient(135deg,
            rgba(16, 185, 129, 0.95),
            rgba(5, 150, 105, 0.95));

    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;

    box-shadow:
        0 2px 8px rgba(5, 150, 105, 0.3),
        inset 0 1px 1px rgba(255, 255, 255, 0.45);

    transform: translateY(-1px);
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.brand:hover .brand-num {
    transform: translateY(-1px) scale(1.08);
    box-shadow:
        0 4px 14px rgba(16, 185, 129, 0.45),
        inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

.brand-name-accent {
    background: linear-gradient(135deg,
            #6366f1 0%,
            #818cf8 50%,
            #a5b4fc 100%);
    background-size: 250% auto;

    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;

    color: #6366f1;
    font-weight: 800;

    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.25));

    transition:
        filter 0.3s ease,
        background-position 0.6s ease;
}

.brand:hover .brand-name-accent {
    background-position: right center;

    filter: drop-shadow(0 0 14px rgba(129, 140, 248, 0.55));
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--color-header-text-muted);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-header-text);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Hamburger menu button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-header-text);
    cursor: pointer;
    padding: 0.5rem;
}

/* Sections */
.main-content {
    flex: 1;
}

.section {
    padding: 0.5rem 0;
}

.bg-surface-elevated {
    background-color: var(--color-surface-elevated);
}

/* Grids */
.grid {
    display: grid;
    gap: 2rem;
}

.grid-3 {
    grid-template-columns: repeat(3, 1-indexed);
    /* Fallback */
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-sidebar {
    grid-template-columns: 2fr 1fr;
}

/* Hero Section Style */
.hero {
    padding: 7.5rem 0;
    text-align: center;
    background: radial-gradient(circle at top left, #1e1b4b, transparent 60%), radial-gradient(circle at bottom right, #064e3b, transparent 60%), #090d16;
    border-bottom: 1px solid #1f2937;
    color: #f9fafb !important;
}

.hero-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 3.5rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #ffffff 40%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #cbd5e1 !important;
    max-width: 720px;
    margin: 0 auto 3rem auto;
    font-weight: 400;
    line-height: 1.6;
}

/* Section Header standard */
.section-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.section-subtitle {
    color: var(--color-text-muted);
    max-width: 580px;
    margin: 0 auto;
}

/* Footer Section */
.footer {
    background-color: var(--color-footer-bg);
    border-top: 1px solid var(--color-footer-border);
    padding: 4.5rem 0 2rem 0;
    font-size: 0.9rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    color: var(--color-footer-text-muted);
}

.footer-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem 3rem 1.5rem;
    display: grid;
    grid-template-columns: 1fr 3.2fr;
    gap: 2.5rem;
}

.footer-brand-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-desc {
    color: var(--color-footer-text-muted);
    max-width: 320px;
}

.footer-links-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1.5rem;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.footer-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: var(--color-footer-text-muted);
}

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

.footer-bottom {
    border-top: 1px solid var(--color-footer-border);
    padding-top: 2rem;
    text-align: center;
    color: var(--color-footer-text-muted);
    font-size: 0.85rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .grid-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .container,
    .header-container,
    .footer-container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .hero-title {
        font-size: 2.25rem;
    }

    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background-color: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: 2rem;
        gap: 1.5rem;
        box-shadow: var(--shadow-lg);
    }

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

    .nav-list {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-controls {
        flex-direction: column;
        align-items: stretch;
        border-top: 1px solid var(--color-border);
        padding-top: 1.5rem;
        gap: 1rem;
    }

    .footer-container {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .footer-links-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

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

/* Category, Tool & Static Page Headers (Premium Dark Styling) */
.category-header,
.tool-header,
.page-header {
    padding: 4.5rem 0 3.5rem 0;
    text-align: center;
    background: radial-gradient(circle at top left, #1e1b4b, transparent 60%), radial-gradient(circle at bottom right, #064e3b, transparent 60%), #090d16;
    border-bottom: 1px solid #1a1924;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    margin-bottom: 3rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    color: #f9fafb !important;
}

.category-header .breadcrumbs,
.tool-header .breadcrumbs,
.page-header .breadcrumbs {
    display: flex;
    justify-content: flex-end;
    padding-top: 0;
    padding-bottom: 0.5rem;
    margin-top: -3.5rem;
    color: #94a3b8;
}

.category-header .breadcrumbs a,
.tool-header .breadcrumbs a,
.page-header .breadcrumbs a {
    color: #cbd5e1;
}

.category-header .breadcrumbs a:hover,
.tool-header .breadcrumbs a:hover,
.page-header .breadcrumbs a:hover {
    color: #818cf8;
}

.category-title,
.tool-title,
.page-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2.75rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff 40%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.category-desc,
.tool-desc,
.page-desc {
    font-size: 1.15rem;
    color: #cbd5e1 !important;
    max-width: 620px;
    margin: 0 auto;
    font-weight: 400;
    line-height: 1.5;
}

/* Header Dropdowns (Premium Dark Styling) */
.header .dropdown-trigger {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-header-text);
}

.header .dropdown-trigger:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--color-header-text);
}

.header .dropdown-menu {
    background-color: var(--color-header-bg);
    border-color: var(--color-header-border);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

.header .dropdown-item {
    color: var(--color-header-text-muted);
}

.header .dropdown-item:hover,
.header .dropdown-item.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-header-text);
}

@media (max-width: 768px) {

    .category-header,
    .tool-header {
        padding: 3rem 0;
        margin-bottom: 2rem;
    }

    .category-header .breadcrumbs,
    .tool-header .breadcrumbs {
        justify-content: center;
        margin-top: -1.5rem;
        padding-bottom: 1rem;
    }

    .category-title,
    .tool-title {
        font-size: 2rem;
    }

    .category-desc,
    .tool-desc {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .header .nav-menu {
        background-color: var(--color-header-bg) !important;
        border-bottom: 1px solid var(--color-header-border) !important;
    }
}

/* Navbar Autocomplete Search Box */
.nav-search-container {
    position: relative;
    margin: 0 1.5rem;
    flex-grow: 1;
    max-width: 200px;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-search-container:focus-within {
    max-width: 280px;
}

.nav-search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    padding: 0.45rem 1rem;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

[data-theme="light"] .nav-search-box {
    background-color: rgba(0, 0, 0, 0.02);
}

.nav-search-box:focus-within {
    border-color: var(--color-primary);
    background-color: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.nav-search-box .search-icon {
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: color 0.3s ease;
}

.nav-search-box:focus-within .search-icon {
    color: var(--color-primary);
}

.nav-search-box input {
    background: none;
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.85rem;
    color: var(--color-text);
    padding: 0;
}

.nav-search-box input::placeholder {
    color: var(--color-text-muted);
}

/* Keyboard Shortcut Indicator */
.search-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-family: inherit;
    padding: 0 0.4rem;
    height: 1.1rem;
    min-width: 1.1rem;
    transition: all 0.2s ease;
    pointer-events: none;
}

[data-theme="light"] .search-kbd {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.08);
}

.nav-search-box:focus-within .search-kbd {
    opacity: 0;
    transform: scale(0.8);
}

.search-clear-btn {
    background: none;
    border: none;
    outline: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.search-clear-btn:hover {
    color: var(--color-text);
}

/* Search Autocomplete Dropdown List */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background-color: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg), 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    z-index: 1000;
    max-height: 320px;
    overflow-y: auto;
    animation: searchDropdownSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .search-results-dropdown {
    background-color: rgba(255, 255, 255, 0.98);
}

@keyframes searchDropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results-dropdown li {
    padding: 0;
}

.search-results-dropdown a {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.2rem;
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.search-results-dropdown a:hover {
    background-color: rgba(255, 255, 255, 0.04);
    border-left-color: var(--color-primary);
    padding-left: 1.35rem;
}

[data-theme="light"] .search-results-dropdown a:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.search-results-dropdown .result-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text);
}

/* Category Badges */
.search-results-dropdown .result-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-results-dropdown .result-badge.image {
    background-color: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.search-results-dropdown .result-badge.document {
    background-color: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.search-results-dropdown .result-badge.pdf {
    background-color: rgba(236, 72, 153, 0.15);
    color: #f472b6;
}

[data-theme="light"] .search-results-dropdown .result-badge.image {
    background-color: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
}

[data-theme="light"] .search-results-dropdown .result-badge.document {
    background-color: rgba(147, 51, 234, 0.08);
    color: #9333ea;
}

[data-theme="light"] .search-results-dropdown .result-badge.pdf {
    background-color: rgba(219, 39, 119, 0.08);
    color: #db2777;
}

.search-results-dropdown .no-results {
    padding: 1rem 1.2rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .nav-search-container {
        margin: 1rem 0;
        max-width: 100% !important;
        width: 100%;
    }

    .search-results-dropdown {
        background-color: var(--color-surface);
    }
}

.feature-card {
    background: linear-gradient(135deg,
            #ffffff 0%,
            #fafafa 50%,
            #f1f5f9 100%);

    border: 1px solid rgba(148, 163, 184, 0.16);

    box-shadow:
        0 4px 16px rgba(15, 23, 42, 0.04),
        0 1px 3px rgba(15, 23, 42, 0.03);

    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

.feature-card:hover {
    transform: translateY(-4px);

    border-color: rgba(var(--color-primary-rgb), 0.22);

    box-shadow:
        0 14px 30px rgba(15, 23, 42, 0.08),
        0 4px 12px rgba(var(--color-primary-rgb), 0.06);
}


/* Dark Theme */
[data-theme="dark"] .feature-card {
    background: linear-gradient(135deg,
            #1e293b 0%,
            #182334 50%,
            #111827 100%);

    border-color: rgba(148, 163, 184, 0.14);

    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.20),
        0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .feature-card:hover {
    border-color: rgba(var(--color-primary-rgb), 0.35);

    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.30),
        0 4px 12px rgba(var(--color-primary-rgb), 0.10);
}