/* ============================================
   Public APIs Directory - Elegant Styles
   ============================================ */

/* CSS Variables */
:root {
    --bg-primary: #f6f7f9;
    --bg-secondary: #ffffff;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f1f4;

    --text-primary: #1a1d2b;
    --text-secondary: #5e6278;
    --text-muted: #a1a5b7;

    --border-color: #e4e6ef;
    --border-hover: #b5b5c3;

    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --accent-light: #eef2ff;

    --badge-yes-bg: #d1fae5;
    --badge-yes-text: #065f46;
    --badge-no-bg: #fee2e2;
    --badge-no-text: #991b1b;
    --badge-unknown-bg: #f3f4f6;
    --badge-unknown-text: #6b7280;
    --badge-apikey-bg: #dbeafe;
    --badge-apikey-text: #1e40af;
    --badge-oauth-bg: #fef3c7;
    --badge-oauth-text: #92400e;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --transition: 150ms ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

button, input, select {
    font-family: inherit;
    font-size: inherit;
}

/* Container */
.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

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

.brand-icon {
    width: 40px;
    height: 40px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
    display: block;
}

/* ============================================
   Controls
   ============================================ */
.controls {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
}

.controls-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-box {
    position: relative;
    width: 100%;
    max-width: 640px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

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

#search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--bg-secondary);
}

.filter-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select {
    padding: 7px 28px 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: var(--bg-secondary);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235e6278' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: border-color var(--transition);
}

.filter-group select:focus {
    border-color: var(--accent-primary);
}

/* ============================================
   Category Tabs
   ============================================ */
.tabs-section {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

.tabs-scroll {
    display: flex;
    gap: 4px;
    padding: 12px 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tabs-scroll::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.tab-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

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

.tab-btn .tab-count {
    font-size: 0.6875rem;
    font-weight: 400;
    margin-left: 4px;
    opacity: 0.7;
}

/* ============================================
   Results
   ============================================ */
.results {
    padding: 32px 0;
    min-height: 400px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.results-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.results-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   API Grid & Cards
   ============================================ */
.api-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 16px;
}

@media (min-width: 640px) {
    .api-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .api-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.api-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: box-shadow var(--transition), transform var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
}

.api-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--border-hover);
}

.api-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 12px;
}

.api-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}

.api-card:hover .api-name {
    color: var(--accent-primary);
}

.api-link-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 2px;
    transition: color var(--transition);
}

.api-card:hover .api-link-icon {
    color: var(--accent-primary);
}

.api-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 14px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.api-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-auth-none {
    background: var(--badge-yes-bg);
    color: var(--badge-yes-text);
}

.badge-auth-apikey {
    background: var(--badge-apikey-bg);
    color: var(--badge-apikey-text);
}

.badge-auth-oauth {
    background: var(--badge-oauth-bg);
    color: var(--badge-oauth-text);
}

.badge-auth-other {
    background: var(--badge-unknown-bg);
    color: var(--badge-unknown-text);
}

.badge-yes {
    background: var(--badge-yes-bg);
    color: var(--badge-yes-text);
}

.badge-no {
    background: var(--badge-no-bg);
    color: var(--badge-no-text);
}

.badge-unknown {
    background: var(--badge-unknown-bg);
    color: var(--badge-unknown-text);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 16px;
}

.btn-clear {
    padding: 10px 24px;
    background: var(--accent-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-clear:hover {
    background: var(--accent-primary-hover);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    background: var(--bg-secondary);
}

.footer p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--accent-primary);
    font-weight: 500;
}

.footer a:hover {
    text-decoration: underline;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .stats {
        width: 100%;
        justify-content: flex-start;
        gap: 32px;
    }

    .filter-row {
        flex-direction: column;
        gap: 8px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-group select {
        flex: 1;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}
