/**
 * AiSmart Glossário - Design System Frontend Moderno (v1.14.0)
 * Grid nativo, CSS puro e zero dependência de Bootstrap CDN externo.
 */

:root {
    --aismart-primary: #2563eb;
    --aismart-primary-hover: #1d4ed8;
    --aismart-surface: #ffffff;
    --aismart-bg: #f8fafc;
    --aismart-text-main: #0f172a;
    --aismart-text-muted: #64748b;
    --aismart-border: #e2e8f0;
    --aismart-radius: 12px;
    --aismart-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --aismart-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.aismart-glossario-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    font-family: inherit;
    box-sizing: border-box;
}

.aismart-glossario-wrapper * {
    box-sizing: border-box;
}

.aismart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

/* Hero Section */
.aismart-glossario-hero {
    padding: 56px 24px 48px 24px;
    color: #ffffff;
    border-radius: 20px;
    margin: 16px auto 28px auto;
    box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.18);
    box-sizing: border-box;
}

.aismart-hero-content {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

.aismart-hero-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    color: #ffffff !important;
}

.aismart-hero-desc {
    font-size: 1.05rem;
    line-height: 1.5;
    opacity: 0.9;
    margin-bottom: 30px;
    color: #e2e8f0 !important;
}

/* Search Box */
.aismart-search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.aismart-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.aismart-search-input {
    width: 100% !important;
    height: 52px !important;
    padding: 12px 20px 12px 50px !important;
    font-size: 1rem !important;
    border-radius: 9999px !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.96) !important;
    color: #0f172a !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.2s ease !important;
}

.aismart-search-input:focus {
    background: #ffffff !important;
    border-color: #3b82f6 !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3) !important;
}

.aismart-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 100;
}

/* Alphabet Nav Pills */
.aismart-alpha-nav {
    background: #ffffff;
    border: 1px solid var(--aismart-border);
    border-radius: 14px;
    padding: 12px 16px;
    margin: 0 auto 36px auto;
    position: sticky;
    top: 16px;
    z-index: 40;
    box-shadow: var(--aismart-shadow-sm);
    box-sizing: border-box;
}

.aismart-alpha-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.aismart-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #334155;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.15s ease;
}

.aismart-pill:hover {
    background: var(--aismart-primary);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Terms Grid */
.aismart-grid-container {
    padding-bottom: 60px;
}

.aismart-letters-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 991px) {
    .aismart-letters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Letter Card */
.aismart-letter-card {
    background: var(--aismart-surface);
    border: 1px solid var(--aismart-border) !important;
    border-radius: var(--aismart-radius) !important;
    box-shadow: var(--aismart-shadow-sm);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.aismart-letter-card:hover {
    box-shadow: var(--aismart-shadow-md);
    border-color: #cbd5e1 !important;
}

.aismart-card-body {
    padding: 20px !important;
}

.aismart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--aismart-border);
}

.aismart-letter-title {
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    color: var(--aismart-text-main) !important;
    margin: 0 !important;
}

.aismart-letter-count {
    background: #f1f5f9 !important;
    color: #475569 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    padding: 4px 8px !important;
    border-radius: 9999px !important;
}

/* Term List */
.aismart-term-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.aismart-term-item {
    padding: 9px 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background: transparent !important;
    line-height: 1.4 !important;
}

.aismart-term-item:last-child {
    border-bottom: none !important;
}

.aismart-term-link {
    color: #1e293b !important;
    text-decoration: none !important;
    font-size: 0.925rem;
    display: block;
    transition: color 0.15s ease, transform 0.15s ease;
}

.aismart-term-link:hover {
    color: var(--aismart-primary) !important;
    transform: translateX(2px);
}

/* Accordion Details/Summary */
.aismart-glossario-details {
    margin-top: 14px;
    border-top: 1px dashed var(--aismart-border);
    padding-top: 12px;
}

.aismart-glossario-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--aismart-primary);
    padding: 6px 4px;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    user-select: none;
}

.aismart-glossario-summary:hover {
    background: #eff6ff;
}

.aismart-glossario-summary::-webkit-details-marker {
    display: none;
}

.aismart-chevron {
    transition: transform 0.2s ease;
}

.aismart-glossario-details[open] .aismart-chevron {
    transform: rotate(180deg);
}

.aismart-term-list-expanded {
    margin-top: 10px !important;
    padding-top: 6px !important;
}

/* Taxonomy Page Grid */
.aismart-tax-grid {
    max-width: 800px;
    margin: 0 auto;
}

.aismart-btn-back {
    display: inline-block;
    padding: 10px 20px;
    background: #ffffff;
    border: 1px solid var(--aismart-border);
    border-radius: 8px;
    color: #334155 !important;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none !important;
    box-shadow: var(--aismart-shadow-sm);
    transition: all 0.2s ease;
}

.aismart-btn-back:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* Limite e contenção do Call to Action na tela do glossário */
.mdg-geo-cta,
.aismart-glossario-wrapper + .mdg-geo-cta {
    max-width: 1200px !important;
    width: calc(100% - 32px) !important;
    margin-left: auto !important;
    margin-right: auto !important;
    box-sizing: border-box !important;
}
