/* Core Theme */
:root {
    --bg: #f4f6ff;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #5b6475;
    --line: #e6e8f3;
    --accent: #3d5bff;
    --accent-2: #7b4dff;
    --accent-soft: linear-gradient(135deg, #6bb5ff 0%, #7a5bff 50%, #ff7ad1 100%);
    --shadow: 0 20px 60px rgba(20, 30, 80, 0.12);
    --radius-lg: 18px;
    --radius-sm: 12px;
}

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

body {
    font-family: 'Manrope', 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle at 15% 20%, rgba(123, 77, 255, 0.12), transparent 25%), radial-gradient(circle at 80% 0%, rgba(61, 91, 255, 0.16), transparent 25%), var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

.hidden {
    display: none !important;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    transition: opacity 0.4s ease;
}

.loading-content {
    text-align: center;
    color: #fff;
}

.loading-spinner {
    width: 58px;
    height: 58px;
    border: 4px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 26px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(230, 232, 243, 0.9);
    backdrop-filter: blur(16px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 1px;
    box-shadow: 0 10px 30px rgba(61, 91, 255, 0.35);
}

.brand-text strong {
    font-size: 1.1rem;
}

.brand-text small {
    color: var(--muted);
    font-size: 0.85rem;
}

.nav-links {
    display: flex;
    gap: 18px;
    align-items: center;
    font-weight: 600;
    color: var(--muted);
}

.nav-links a {
    padding: 10px 14px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    color: var(--text);
    background: #eef2ff;
}

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

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    color: var(--muted);
    transition: all 0.2s ease;
}

.icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 12px 30px rgba(61, 91, 255, 0.12);
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.1px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.pill-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25);
}

.pill-count {
    background: rgba(255, 255, 255, 0.18);
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.85rem;
    min-width: 24px;
    text-align: center;
}

/* Hero */
.hero {
    padding: 42px 24px 28px;
}

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
    align-items: stretch;
}

.hero-copy {
    background: linear-gradient(145deg, #ffffff 0%, #f5f6ff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px 30px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.hero-copy::after {
    content: "";
    position: absolute;
    right: -120px;
    top: -60px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle at 30% 30%, rgba(61, 91, 255, 0.25), transparent 65%);
    transform: rotate(-8deg);
}

.hero-copy h1 {
    font-size: 2.4rem;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hero-copy .lede {
    color: var(--muted);
    max-width: 520px;
    margin-bottom: 18px;
}

.eyebrow {
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.2rem;
    color: var(--accent);
    font-weight: 700;
}

.lede {
    font-size: 1.05rem;
}

.search-container {
    position: relative;
    margin: 18px 0 12px;
}

.search-input {
    width: 100%;
    padding: 16px 120px 16px 52px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 1rem;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 16px 36px rgba(61, 91, 255, 0.18);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.clear-search {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: #0f172a;
    color: #fff;
    padding: 8px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.clear-search:hover {
    background: #152447;
}

.quick-tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.chip {
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 600;
    font-size: 0.92rem;
}

.chip:hover {
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 10px 24px rgba(61, 91, 255, 0.12);
}

.chip.active {
    background: #eef2ff;
    color: var(--accent);
    border-color: var(--accent);
}

.chip.muted {
    cursor: default;
    opacity: 0.7;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.stat {
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    border: 1px solid var(--line);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
}

.stat-number {
    display: block;
    font-size: 1.9rem;
    font-weight: 700;
}

.stat-label {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.1rem;
}

.hero-panel {
    display: flex;
    align-items: stretch;
}

.panel-card {
    background: linear-gradient(165deg, #0f172a 0%, #1b2140 50%, #2d2f4f 100%);
    color: #fff;
    padding: 26px;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-label {
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    font-size: 0.82rem;
    color: #a0b3ff;
}

.panel-copy {
    color: rgba(255, 255, 255, 0.8);
}

.panel-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.view-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-btn.ghost {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
}

.view-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.view-btn.active {
    background: #fff;
    color: var(--accent);
    border-color: #fff;
}

/* Layout */
.layout {
    max-width: 1200px;
    margin: 0 auto 64px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    padding: 0 24px;
}

.filters-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    align-self: start;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.hint {
    color: var(--muted);
    font-size: 0.95rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 14px 0;
}

.filter-group label {
    font-weight: 700;
    color: var(--text);
}

.filter-select {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #f8f9ff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 10px 22px rgba(61, 91, 255, 0.12);
    background: #fff;
}

.filter-note {
    background: #f4f6ff;
    border: 1px dashed #d2d7f5;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--muted);
}

.content-panel {
    background: transparent;
}

.content-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

/* Cards */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

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

.tool-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    gap: 14px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
}

.tool-thumb {
    width: 86px;
    height: 86px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: #eef2ff;
    border: 1px solid var(--line);
}

.tool-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tool-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.category {
    background: #eef2ff;
    color: var(--accent);
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
}

.tool-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.tool-description {
    color: var(--muted);
    font-size: 0.95rem;
}

.tag-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    background: #f4f6ff;
    border: 1px solid #e5e7f5;
    color: #3b4266;
    padding: 6px 10px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
}

.card-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
}

.link-btn, .secondary-link {
    border: none;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.link-btn {
    background: var(--accent-soft);
    color: #fff;
    box-shadow: 0 14px 30px rgba(61, 91, 255, 0.25);
}

.link-btn:hover {
    transform: translateY(-1px);
}

.secondary-link {
    background: #f8f9ff;
    color: var(--text);
    border: 1px solid var(--line);
}

.secondary-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.favorite-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    color: #d1d5e8;
    cursor: pointer;
    transition: all 0.2s ease;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.favorite-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.favorite-btn.active {
    color: #ff5c8a;
    border-color: #ffb3c7;
    background: #fff5f8;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: var(--radius-lg);
    color: var(--muted);
    margin-top: 16px;
}

.empty-state i {
    font-size: 2.6rem;
    margin-bottom: 10px;
    color: var(--accent);
}

/* Table view */
.table-container {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-top: 10px;
}

.table-view {
    width: 100%;
}

.table-header, .table-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr 3fr 1.4fr;
    gap: 10px;
    align-items: center;
}

.table-header {
    background: #0f172a;
    color: #fff;
    padding: 14px 18px;
    font-weight: 700;
}

.table-row {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    transition: background 0.15s ease;
}

.table-row:hover {
    background: #f8f9ff;
}

.table-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--line);
}

.category-badge {
    background: #eef2ff;
    color: var(--accent);
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
}

.description-cell p {
    color: var(--muted);
    font-size: 0.95rem;
}

.actions-cell {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-details-table {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #f8f9ff;
    cursor: pointer;
    color: var(--muted);
}

.btn-details-table:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(12, 18, 38, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    backdrop-filter: blur(6px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    border-radius: var(--radius-lg);
    width: min(560px, 92vw);
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(12, 18, 38, 0.3);
}

.modal-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.close-btn {
    border: none;
    background: #f4f6ff;
    color: var(--muted);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--accent);
}

.favorites-list {
    padding: 16px;
    overflow-y: auto;
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;
}

.toast {
    background: #fff;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    min-width: 260px;
}

.toast.success { border-left: 4px solid #16a34a; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid var(--accent); }

/* Details Modal */
.details-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.details-modal.show {
    opacity: 1;
    visibility: visible;
}

.details-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 18, 38, 0.6);
    backdrop-filter: blur(8px);
}

.details-content {
    background: #fff;
    border-radius: var(--radius-lg);
    max-width: 860px;
    width: 92vw;
    max-height: 88vh;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(12, 18, 38, 0.35);
    position: relative;
    z-index: 1;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s ease;
}

.details-modal.show .details-content {
    transform: translateY(0) scale(1);
}

.details-header {
    background: linear-gradient(120deg, #0f172a 0%, #1a2d6a 50%, #2f3fad 100%);
    color: #fff;
    padding: 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.details-hero {
    display: flex;
    gap: 16px;
    align-items: center;
}

.details-image {
    width: 110px;
    height: 110px;
    border-radius: 18px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.25);
}

.details-hero-content h1 {
    margin: 0 0 6px 0;
}

.details-hero-content .category {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.details-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.details-section {
    margin-bottom: 20px;
}

.details-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.details-section p {
    color: var(--muted);
}

.features-grid {
    display: grid;
    gap: 10px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f5f6ff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-soft);
    color: #fff;
    box-shadow: 0 14px 30px rgba(61, 91, 255, 0.25);
}

.btn-secondary {
    background: #f8f9ff;
    color: var(--text);
    border: 1px solid var(--line);
}

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

@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        gap: 12px;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
    }
    .content-toolbar {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    .tools-grid {
        grid-template-columns: 1fr;
    }
    .tool-card {
        flex-direction: column;
    }
    .table-header, .table-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
    .table-row {
        padding: 12px;
    }
    .hero {
        padding: 28px 18px 20px;
    }
}
