/**
 * Banco de Datasheet - Design Minimalista & Moderno
 * Tema Preto Profundo (Padrão) + Modo Luz Branca (Light)
 */

:root {
    --bg-main: #000000;
    --bg-surface: #0a0a0a;
    --bg-card: #111111;
    --bg-card-hover: #171717;
    --bg-input: #0a0a0a;
    
    --border-color: #222222;
    --border-hover: #444444;
    --border-highlight: #ffffff;

    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --accent-primary: #ffffff;
    --accent-contrast: #000000;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #a855f7;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;

    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.8);
    --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ====================================================
   TEMA LUZ BRANCA (LIGHT THEME)
   ==================================================== */
html.light-theme {
    --bg-main: #ffffff;
    --bg-surface: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #ffffff;

    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-highlight: #000000;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent-primary: #0f172a;
    --accent-contrast: #ffffff;

    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.06);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.25s ease, color 0.25s ease;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-sm {
    max-width: 760px;
}

/* ====================================================
   HEADER & NAVBAR MINIMALISTA
   ==================================================== */
.site-header {
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

html.light-theme .site-header {
    background: rgba(255, 255, 255, 0.85);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.brand-icon {
    font-size: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text-primary);
}

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

.stats-pills {
    display: flex;
    gap: 8px;
}

.pill-stat {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.pill-stat strong {
    color: var(--text-primary);
}

/* Botão Alternador de Luz Branca / Escurecer */
.theme-toggle-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

.theme-icon {
    font-size: 14px;
}

/* Botão Login */
.btn-login {
    background: var(--accent-primary);
    color: var(--accent-contrast) !important;
    border: 1px solid var(--accent-primary);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 0.84rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-login:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ====================================================
   HERO / SEARCH MINIMALISTA
   ==================================================== */
.hero-section {
    padding: 60px 24px 45px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
}

html.light-theme .hero-section {
    background: radial-gradient(circle at 50% 0%, rgba(0, 0, 0, 0.02) 0%, transparent 60%);
}

.hero-container {
    max-width: 780px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 30px;
    font-weight: 400;
}

/* Campo de Busca Minimalista */
.search-form-hero {
    margin-top: 10px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    transition: var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--border-highlight);
    box-shadow: 0 0 0 1px var(--border-highlight);
}

.search-icon {
    position: absolute;
    left: 20px;
    font-size: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-hero {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    padding: 16px 50px 16px 54px;
    font-family: inherit;
}

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

.btn-clear-search {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 6px 12px;
    transition: var(--transition);
}

.btn-clear-search:hover {
    color: var(--text-primary);
}

.btn-search-submit {
    background-color: var(--accent-primary);
    color: var(--accent-contrast);
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 22px;
    font-size: 0.92rem;
    font-weight: 600;
    margin-right: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-search-submit:hover {
    opacity: 0.88;
}

/* Abas de Categorias Minimalistas */
.category-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
}

.tab-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 7px 16px;
    border-radius: var(--radius-full);
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.tab-btn.active {
    background: var(--accent-primary);
    color: var(--accent-contrast);
    border-color: var(--accent-primary);
    font-weight: 600;
}

/* ====================================================
   CONTEÚDO & GRID DE RESULTADOS
   ==================================================== */
.content-section {
    flex: 1;
    padding: 40px 0 70px;
}

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

.results-info {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.results-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.results-title .highlight {
    color: var(--accent-cyan);
}

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

/* Spinner de Busca */
.search-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Grid de Cards */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

.file-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-subtle);
}

.file-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.file-card-body {
    flex: 1;
}

.file-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
    word-break: break-word;
    letter-spacing: -0.2px;
}

.file-metadata {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.meta-item {
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-label {
    color: var(--text-muted);
}

.meta-value {
    color: var(--text-secondary);
    font-weight: 500;
}

.board-chip {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.25);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

html.light-theme .board-chip {
    background: rgba(6, 182, 212, 0.12);
    color: #0891b2;
    border-color: rgba(6, 182, 212, 0.3);
}

.file-notes {
    background: var(--bg-surface);
    border-left: 2px solid var(--accent-amber);
    padding: 8px 12px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 10px 0;
    max-height: 60px;
    overflow-y: auto;
}

.file-subdetails {
    display: flex;
    gap: 14px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* Ações no Card */
.file-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
}

.btn-action-view {
    flex: 1;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 9px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.86rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-action-view:hover {
    background: var(--accent-primary);
    color: var(--accent-contrast) !important;
    border-color: var(--accent-primary);
}

.btn-action-download {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 9px 14px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.86rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-action-download:hover {
    background: var(--accent-primary);
    color: var(--accent-contrast) !important;
    border-color: var(--accent-primary);
}

.btn-block {
    width: 100%;
}

/* ====================================================
   BADGES & EXTENSÕES
   ==================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

.badge-esquema {
    background: rgba(168, 85, 247, 0.12);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.badge-boardview {
    background: rgba(6, 182, 212, 0.12);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.badge-bios {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-datasheet {
    background: rgba(245, 158, 11, 0.12);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-manual {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.badge-outro {
    background: rgba(113, 113, 122, 0.12);
    color: #a1a1aa;
    border: 1px solid rgba(113, 113, 122, 0.25);
}

html.light-theme .badge-esquema { color: #9333ea; }
html.light-theme .badge-boardview { color: #0891b2; }
html.light-theme .badge-bios { color: #059669; }
html.light-theme .badge-datasheet { color: #d97706; }
html.light-theme .badge-manual { color: #4f46e5; }

.file-ext-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.ext-pdf { color: #f87171; border-color: rgba(239, 68, 68, 0.25); }
.ext-bin, .ext-rom { color: #34d399; border-color: rgba(16, 185, 129, 0.25); }
.ext-brd, .ext-cad, .ext-fz, .ext-asc, .ext-bv { color: #38bdf8; border-color: rgba(56, 189, 248, 0.25); }
.ext-zip, .ext-rar, .ext-7z { color: #fbbf24; border-color: rgba(251, 191, 36, 0.25); }

/* ====================================================
   BOTÕES E FORMULÁRIOS GERAIS
   ==================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: var(--accent-contrast);
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--border-highlight);
    color: var(--text-primary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    background: var(--accent-red);
    color: #ffffff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--border-highlight);
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 0.82rem;
}

/* ====================================================
   PAGINAÇÃO & ESTADOS
   ==================================================== */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination {
    display: flex;
    gap: 6px;
}

.page-link {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.page-link:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.page-link.active {
    background: var(--accent-primary);
    color: var(--accent-contrast);
    border-color: var(--accent-primary);
}

.no-results-box {
    grid-column: 1 / -1;
    text-align: center;
    padding: 70px 20px;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
}

.no-results-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.no-results-box h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-results-box p {
    color: var(--text-muted);
    max-width: 480px;
    margin: 0 auto;
}

.mt-3 {
    margin-top: 15px;
}

/* ====================================================
   FOOTER
   ==================================================== */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 26px 0;
    margin-top: auto;
}

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

.footer-left p {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 4px;
}

.footer-right a {
    color: var(--text-secondary);
    font-size: 0.84rem;
    transition: var(--transition);
}

.footer-right a:hover {
    color: var(--text-primary);
}

/* ====================================================
   MODAL POPUP DE ASSINATURA & LIMITES
   ==================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 34px 28px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    text-align: center;
    animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-close-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--text-primary);
}

.modal-icon {
    font-size: 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    width: 58px;
    height: 58px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.4px;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 22px;
}

.modal-pricing-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.pricing-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.pricing-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 4px 0;
    letter-spacing: -0.5px;
}

.pricing-period {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pricing-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--accent-green);
    font-weight: 600;
}

.modal-benefits {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.modal-benefits li span {
    color: var(--accent-green);
    font-weight: 700;
    margin-right: 6px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-lg {
    padding: 12px 20px;
    font-size: 0.95rem;
}

/* Badges e Pílulas de Usuário */
.pill-vip {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    font-weight: 700;
}

.pill-usage strong {
    color: var(--accent-amber) !important;
}

.btn-upgrade {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d !important;
    border: 1px solid rgba(245, 158, 11, 0.4);
    font-weight: 700;
    border-radius: var(--radius-full);
}

.btn-upgrade:hover {
    background: var(--accent-amber);
    color: #000000 !important;
}

.user-name-tag {
    font-size: 0.84rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ====================================================
   RESPONSIVO
   ==================================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 1.7rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .search-input-hero {
        font-size: 0.95rem;
        padding: 12px 40px 12px 46px;
    }

    .files-grid {
        grid-template-columns: 1fr;
    }

    .d-none-mobile {
        display: none !important;
    }

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

    .pagination-wrapper {
        flex-direction: column;
        gap: 14px;
        align-items: center;
    }
}
