/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #0a1929;
    --text-secondary: #4a5a72;
    --text-muted: #94a3b8;
    --border: #e4e9f2;
    --primary: #2563eb;
    --primary-light: #eef2ff;
    --radius: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-hover: 0 12px 40px rgba(37, 99, 235, 0.12);
    --shadow-card: 0 8px 32px rgba(0,0,0,0.06);
    --transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== HEADER ===== */
header {
    padding: 18px 0 20px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.85);
    flex-shrink: 0;
    border-bottom: none;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
    flex-shrink: 0;
}

.logo span {
    color: var(--primary);
}

.search-wrap {
    position: relative;
    flex: 1;
    max-width: 380px;
    min-width: 170px;
}

.search-wrap input {
    width: 100%;
    padding: 9px 16px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text);
    transition: var(--transition);
    outline: none;
}

.search-wrap input:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

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

.search-wrap .clear-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 6px;
    border-radius: 4px;
    display: none;
    transition: var(--transition);
}

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

.search-wrap .clear-btn.visible {
    display: block;
}

/* Suggestions */
.suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    max-height: 320px;
    overflow-y: auto;
    display: none;
    padding: 4px 0;
    z-index: 100;
}

.suggestions.active {
    display: block;
    animation: fadeIn 0.15s ease;
}

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

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.suggestion-item:hover {
    background: var(--primary-light);
}

.suggestion-item .name {
    flex: 1;
}

.suggestion-item .category-tag {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.suggestion-item .highlight {
    font-weight: 600;
    color: var(--primary);
}

/* ===== HERO SECTION ===== */
.hero {
    padding: 20px 0 36px;
    background: var(--surface);
}

.hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

.hero-left {
    flex: 1;
}

.hero-tagline {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.hero-tagline .highlight {
    color: var(--primary);
}

.hero-sub {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 400;
}

.hero-right {
    flex-shrink: 0;
    position: relative;
    margin-left: -20px;
}

/* ===== CARD STACK ===== */
.card-stack {
    position: relative;
    width: 160px;
    height: 160px;
    transform: translateX(-70px);
}

.card-stack .card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transform: translateY(0) scale(1) rotate(0deg);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.card-stack .card.active {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
    pointer-events: auto;
    z-index: 3;
}

.card-stack .card.flying {
    opacity: 0;
    transform: translateY(-70px) translateX(50px) rotate(45deg) scale(0.85);
    z-index: 4;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-stack .card.entering {
    opacity: 0;
    transform: translateY(30px) scale(0.92) rotate(-3deg);
    z-index: 1;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-stack .card.enter-active {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
    z-index: 3;
    pointer-events: auto;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card-stack .card.waiting {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    z-index: 0;
    pointer-events: none;
}

.card-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    color: var(--primary);
}

.card-icon svg {
    width: 100%;
    height: 100%;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ===== MAIN CONTENT ===== */
main {
    flex: 1 0 auto;
}

/* Categories - Accordion */
.categories {
    margin: 28px 0 8px;
}

.category-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow);
}

.category-item:hover {
    border-color: var(--primary);
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
    background: var(--surface);
}

.category-header:hover {
    background: var(--primary-light);
}

.category-header .label {
    font-weight: 600;
    font-size: 0.95rem;
}

.category-header .right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-header .count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.category-header .chevron {
    color: var(--text-muted);
    font-size: 0.7rem;
    transition: transform var(--transition), color var(--transition);
    display: inline-block;
}

.category-item.expanded {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.08);
}

.category-item.expanded .category-header {
    background: var(--primary-light);
}

.category-item.expanded .count {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.category-item.expanded .chevron {
    transform: rotate(90deg);
    color: var(--primary);
}

.category-tools-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--transition);
    overflow: hidden;
}

.category-tools-wrapper.expanded {
    grid-template-rows: 1fr;
}

.category-tools-inner {
    overflow: hidden;
    padding: 0 18px;
}

.category-tools-inner > * {
    padding: 4px 0 18px 0;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (max-width: 640px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    opacity: 0;
    transform: translateY(-6px);
}

.category-tools-wrapper.expanded .tool-card {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.05s;
}

.category-tools-wrapper.expanded .tool-card:nth-child(2) {
    transition-delay: 0.08s;
}

.category-tools-wrapper.expanded .tool-card:nth-child(3) {
    transition-delay: 0.11s;
}

.category-tools-wrapper.expanded .tool-card:nth-child(4) {
    transition-delay: 0.14s;
}

.category-tools-wrapper.expanded .tool-card:nth-child(5) {
    transition-delay: 0.17s;
}

.category-tools-wrapper.expanded .tool-card:nth-child(6) {
    transition-delay: 0.2s;
}

.tool-card:hover {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px) !important;
}

.tool-card .icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 8px;
    color: var(--primary);
    border: 1px solid var(--border);
}

.tool-card .icon svg {
    width: 16px;
    height: 16px;
}

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

.tool-card .info h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1px;
}

.tool-card .info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-card .arrow {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.tool-card:hover .arrow {
    color: var(--primary);
    transform: translateX(2px);
}

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

.search-results-header {
    padding: 8px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    display: none;
}

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

.search-results-header .result-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.search-results-header .result-count strong {
    color: var(--text);
    font-weight: 600;
}

.no-results {
    text-align: center;
    padding: 60px 20px 40px;
    display: none;
    color: var(--text-secondary);
}

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

.no-results .icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

.no-results p {
    font-size: 0.95rem;
}

/* ===== FOOTER ===== */
footer {
    flex-shrink: 0;
    margin-top: 60px;
    padding: 40px 0 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.footer-inner {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.2fr 1.5fr;
    gap: 40px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
    }
}

@media (max-width: 640px) {
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.footer-brand-col {
    max-width: 280px;
}

.footer-brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.footer-brand span {
    color: var(--primary);
}

.footer-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.footer-col h5 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-weight: 600;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 8px;
}

.footer-col ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-col ul li a:hover {
    color: var(--primary);
}

.social-links li a {
    display: flex;
    align-items: center;
    gap: 10px;
}

.social-links li a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: var(--transition);
}

.social-links li a:hover svg {
    color: var(--primary);
}

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

.suggestions::-webkit-scrollbar {
    width: 4px;
}

.suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.suggestions::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .hero-right {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        margin-left: 0;
    }
    
    .card-stack {
        width: 140px;
        height: 140px;
    }
    
    .hero-tagline {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .card-stack {
        width: 120px;
        height: 120px;
    }
    
    .card-stack .card {
        padding: 18px;
        border-radius: 20px;
    }
    
    .card-icon {
        width: 36px;
        height: 36px;
        margin-bottom: 8px;
    }
    
    .card-title {
        font-size: 0.75rem;
    }
}