/**
 * Tools Hub Pro - Framework CSS
 * Modern design system for all tools
 */

:root {
    --thp-primary: #6366f1;
    --thp-primary-dark: #4f46e5;
    --thp-primary-darker: #4338ca;
    --thp-primary-light: #eef2ff;
    --thp-accent: #ec4899;
    --thp-success: #10b981;
    --thp-warning: #f59e0b;
    --thp-danger: #ef4444;
    --thp-text: #0f172a;
    --thp-text-light: #475569;
    --thp-text-muted: #94a3b8;
    --thp-border: #e2e8f0;
    --thp-bg: #ffffff;
    --thp-bg-soft: #f8fafc;
    --thp-radius: 16px;
    --thp-radius-md: 12px;
    --thp-radius-sm: 8px;
    --thp-shadow-sm: 0 1px 3px rgba(15,23,42,0.06);
    --thp-shadow: 0 4px 12px rgba(15,23,42,0.08);
    --thp-shadow-lg: 0 20px 40px -8px rgba(99,102,241,0.15);
    --thp-transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

/* === COMMON === */
.thp-directory,
.thp-single-page,
.thp-category-page,
.thp-search-wrapper,
.thp-featured,
.thp-related {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
    color: var(--thp-text);
    line-height: 1.6;
    max-width: 1200px;
    margin: 24px auto;
    -webkit-font-smoothing: antialiased;
}

.thp-directory *, .thp-single-page *, .thp-category-page * {
    box-sizing: border-box;
}

.thp-error {
    background: #fee2e2;
    border-left: 4px solid var(--thp-danger);
    color: #991b1b;
    padding: 14px 18px;
    border-radius: var(--thp-radius-sm);
    font-weight: 600;
}

/* === BREADCRUMBS === */
.thp-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 0;
    font-size: 14px;
    color: var(--thp-text-muted);
    flex-wrap: wrap;
}

.thp-breadcrumbs a {
    color: var(--thp-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--thp-transition);
}

.thp-breadcrumbs a:hover {
    color: var(--thp-primary-dark);
    text-decoration: underline;
}

.thp-breadcrumbs .thp-current {
    color: var(--thp-text);
    font-weight: 600;
}

/* === DIRECTORY / CATEGORY HEADERS === */
.thp-directory-header,
.thp-category-hero,
.thp-tool-hero {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    color: #fff;
    padding: 48px 32px;
    border-radius: var(--thp-radius);
    margin-bottom: 32px;
    text-align: center;
    box-shadow: var(--thp-shadow-lg);
    position: relative;
    overflow: hidden;
}

.thp-directory-header::before,
.thp-category-hero::before,
.thp-tool-hero::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.thp-directory-title {
    font-size: 40px;
    font-weight: 800;
    margin: 0 0 10px 0;
    color: #fff;
    letter-spacing: -1px;
    position: relative;
    z-index: 1;
}

.thp-directory-subtitle {
    font-size: 17px;
    margin: 0 0 24px 0;
    color: rgba(255,255,255,0.95);
    position: relative;
    z-index: 1;
}

/* === CATEGORY HERO === */
.thp-category-hero {
    background: linear-gradient(135deg, var(--cat-color) 0%, color-mix(in srgb, var(--cat-color) 60%, #000) 100%);
}

.thp-cat-hero-icon {
    font-size: 64px;
    margin-bottom: 14px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
    position: relative;
    z-index: 1;
}

.thp-category-hero h1,
.thp-category-hero h2 {
    color: #fff !important;
    font-size: 34px !important;
    font-weight: 800 !important;
    margin: 0 0 8px 0 !important;
    position: relative;
    z-index: 1;
}

.thp-category-hero p {
    color: rgba(255,255,255,0.95) !important;
    font-size: 16px;
    margin: 0;
    position: relative;
    z-index: 1;
}

/* === TOOL HERO === */
.thp-tool-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    text-align: left;
    padding: 32px;
}

.thp-tool-hero-icon {
    font-size: 64px;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
    position: relative;
    z-index: 1;
}

.thp-tool-hero-title {
    font-size: 34px !important;
    font-weight: 800 !important;
    margin: 0 0 6px 0 !important;
    color: #fff !important;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.thp-tool-hero-desc {
    margin: 0;
    font-size: 16px;
    color: rgba(255,255,255,0.95);
    position: relative;
    z-index: 1;
}

/* === SEARCH === */
.thp-search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    z-index: 2;
}

.thp-search-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: none;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    background: #fff;
    color: var(--thp-text);
    outline: none;
    font-family: inherit;
    font-weight: 500;
}

.thp-search-input:focus {
    box-shadow: 0 10px 30px rgba(0,0,0,0.2), 0 0 0 4px rgba(255,255,255,0.3);
}

.thp-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: var(--thp-radius-md);
    box-shadow: var(--thp-shadow-lg);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.thp-search-results.active {
    display: block;
}

.thp-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--thp-text);
    border-bottom: 1px solid var(--thp-border);
    transition: var(--thp-transition);
}

.thp-search-result-item:hover {
    background: var(--thp-primary-light);
    color: var(--thp-primary-dark);
}

.thp-search-result-item:last-child {
    border-bottom: none;
}

.thp-search-result-icon {
    font-size: 24px;
}

.thp-search-result-info h4 {
    margin: 0 0 2px 0;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
}

.thp-search-result-info p {
    margin: 0;
    font-size: 12px;
    color: var(--thp-text-muted);
    text-align: left;
}

/* === CATEGORY SECTIONS === */
.thp-category-section {
    margin-bottom: 40px;
}

.thp-category-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-left: 5px solid var(--cat-color);
    border-radius: var(--thp-radius-md);
    margin-bottom: 20px;
    box-shadow: var(--thp-shadow-sm);
}

.thp-category-heading .thp-cat-icon {
    font-size: 32px;
}

.thp-category-heading h2,
.thp-category-heading h3 {
    margin: 0 !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    color: var(--cat-color) !important;
    flex: 1;
}

.thp-cat-count {
    background: var(--thp-bg-soft);
    color: var(--thp-text-light);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

/* === TOOLS GRID === */
.thp-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.thp-tool-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    background: #fff;
    border: 2px solid var(--thp-border);
    border-radius: var(--thp-radius-md);
    text-decoration: none !important;
    color: var(--thp-text);
    transition: var(--thp-transition);
    box-shadow: var(--thp-shadow-sm);
}

.thp-tool-card:hover {
    border-color: var(--thp-primary);
    transform: translateY(-3px);
    box-shadow: var(--thp-shadow-lg);
    color: var(--thp-text);
}

.thp-tool-icon {
    font-size: 36px;
    flex-shrink: 0;
    line-height: 1;
}

.thp-tool-info {
    flex: 1;
    min-width: 0;
}

.thp-tool-info h4 {
    margin: 0 0 4px 0 !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--thp-text) !important;
    letter-spacing: -0.2px;
}

.thp-tool-info p {
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--thp-text-muted) !important;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.thp-tool-arrow {
    font-size: 20px;
    color: var(--thp-primary);
    font-weight: 700;
    opacity: 0;
    transition: var(--thp-transition);
}

.thp-tool-card:hover .thp-tool-arrow {
    opacity: 1;
    transform: translateX(4px);
}

/* === TOOL RENDER WRAPPER === */
.thp-tool-render {
    background: #fff;
    border-radius: var(--thp-radius);
    box-shadow: var(--thp-shadow-lg);
    margin-bottom: 32px;
    overflow: hidden;
}

/* === TOOL CONTENT (markdown from content.md) === */
.thp-tool-content {
    background: #fff;
    border-radius: var(--thp-radius);
    padding: 32px;
    box-shadow: var(--thp-shadow);
    margin-bottom: 32px;
}

.thp-tool-content h1,
.thp-tool-content h2,
.thp-tool-content h3 {
    color: var(--thp-text);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.thp-tool-content h2 {
    font-size: 24px;
    border-bottom: 2px solid var(--thp-border);
    padding-bottom: 10px;
}

.thp-tool-content h3 {
    font-size: 19px;
    color: var(--thp-primary-dark);
}

.thp-tool-content p {
    line-height: 1.7;
    color: var(--thp-text-light);
    margin: 12px 0;
}

.thp-tool-content ul,
.thp-tool-content ol {
    color: var(--thp-text-light);
    line-height: 1.8;
    padding-left: 24px;
}

.thp-tool-content strong {
    color: var(--thp-text);
}

/* === FEATURED & RELATED === */
.thp-featured-title,
.thp-related-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 20px 0;
    color: var(--thp-text);
    background: linear-gradient(135deg, var(--thp-primary) 0%, var(--thp-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.thp-related {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px dashed var(--thp-border);
}

.thp-featured-card {
    background: linear-gradient(135deg, #fff 0%, var(--thp-primary-light) 100%);
    border-color: var(--thp-primary);
}

/* === EMPTY STATE === */
.thp-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--thp-text-muted);
    background: #fff;
    border-radius: var(--thp-radius);
    box-shadow: var(--thp-shadow-sm);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .thp-directory-header,
    .thp-category-hero,
    .thp-tool-hero {
        padding: 32px 20px;
    }

    .thp-directory-title {
        font-size: 30px;
    }

    .thp-tool-hero {
        flex-direction: column;
        text-align: center;
        gap: 14px;
    }

    .thp-tool-hero-icon {
        font-size: 56px;
    }

    .thp-tool-hero-title {
        font-size: 28px !important;
    }

    .thp-category-hero h1,
    .thp-category-hero h2 {
        font-size: 26px !important;
    }

    .thp-cat-hero-icon {
        font-size: 56px;
    }

    .thp-tools-grid {
        grid-template-columns: 1fr;
    }

    .thp-category-heading {
        padding: 14px 16px;
    }

    .thp-category-heading h2,
    .thp-category-heading h3 {
        font-size: 18px !important;
    }

    .thp-tool-content {
        padding: 22px 18px;
    }
}

@media (max-width: 480px) {
    .thp-directory,
    .thp-single-page,
    .thp-category-page {
        margin: 12px auto;
    }

    .thp-directory-title {
        font-size: 24px;
    }

    .thp-search-input {
        font-size: 14px;
        padding: 14px 18px;
    }
}
