* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00f3ff;
    --primary-glow: rgba(0, 243, 255, 0.4);
    --accent: #00ff88;
    --dark: #0a0a14;
    --darker: #05050a;
    --light: #e0e0ff;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --neon-shadow: 0 0 20px rgba(0, 243, 255, 0.3);
}

body {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--darker);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    font-weight: 300;
    letter-spacing: 0;
}

.top-bar {
    position: fixed;
    top: 14px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 40;
    pointer-events: none;
}

.top-actions,
.top-link,
.top-auth-btn {
    pointer-events: auto;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-link {
    height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    text-decoration: none;
    color: rgba(224, 224, 255, 0.82);
    background: rgba(0, 0, 0, 0.25);
    font-size: 13px;
}

.top-auth-btn {
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 243, 255, 0.35);
    background: rgba(0, 243, 255, 0.12);
    color: var(--primary);
    cursor: pointer;
    font-size: 13px;
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image: 
        linear-gradient(var(--glass-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
    background-size: 100px 100px;
    opacity: 0.05;
    transform: perspective(500px) rotateX(60deg);
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: perspective(500px) rotateX(60deg) translateY(0); }
    100% { transform: perspective(500px) rotateX(60deg) translateY(100px); }
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 1px;
    height: 1px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary);
    animation: float 20s infinite linear;
}

@keyframes float {
    0% { transform: translateY(100vh) translateX(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(100px); opacity: 0; }
}

.glow-effect {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    filter: blur(80px);
    opacity: 0.08;
    animation: pulse 12s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.7); opacity: 0.05; }
    100% { transform: translate(-50%, -50%) scale(1.1); opacity: 0.12; }
}

.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4.5rem 2rem 2rem;
    position: relative;
}

.hero {
    text-align: center;
    max-width: 600px;
    margin-bottom: 3rem;
    z-index: 10;
}

.title {
    font-family: 'Orbitron', monospace;
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 4px;
    margin-bottom: 1.5rem;
    color: var(--light);
}

.title .x {
    color: var(--accent);
    font-weight: 400;
    position: relative;
    top: 2px;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
}

.instruction {
    font-size: 1rem;
    font-weight: 300;
    color: rgba(224, 224, 255, 0.6);
    line-height: 1.5;
    margin-bottom: 2rem;
}

.search-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    z-index: 10;
}

.search-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.search-input {
    width: 100%;
    padding: 1.2rem 1.8rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--light);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-weight: 300;
    letter-spacing: 0.2px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-1px);
}

.search-input::placeholder {
    color: rgba(224, 224, 255, 0.3);
    font-weight: 300;
}

.search-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    opacity: 0.5;
    transition: opacity 0.3s;
    pointer-events: none;
    font-size: 0.9rem;
}

.search-input:focus + .search-icon {
    opacity: 1;
}

.search-btn {
    padding: 0.9rem 2.5rem;
    font-size: 0.95rem;
    font-weight: 400;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 243, 255, 0.3);
    color: var(--primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
}

.search-btn:hover {
    background: rgba(0, 243, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(0, 243, 255, 0.2);
}

.search-btn:active {
    transform: translateY(0);
}

.results-section {
    width: 100%;
    max-width: 1200px;
    margin-top: 3rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.results-section.show {
    opacity: 1;
    transform: translateY(0);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.results-title {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--light);
}

.results-count {
    font-size: 0.85rem;
    color: rgba(224, 224, 255, 0.4);
    font-weight: 300;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.2rem;
}

.document-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.document-thumb-wrap {
    height: 150px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 18, 31, 0.9);
    margin-bottom: 10px;
    position: relative;
}

.document-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.document-thumb-icon {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(224, 224, 255, 0.88);
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.45);
}

.document-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 243, 255, 0.2);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.document-icon {
    width: 32px;
    height: 32px;
    background: rgba(0, 243, 255, 0.08);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
    color: var(--primary);
    font-size: 0.9rem;
}

.document-name {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 0.8rem;
    line-height: 1.4;
    color: var(--light);
}

.category-section {
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.category-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.category-label {
    display: inline-block;
    font-size: 0.7rem;
    color: rgba(224, 224, 255, 0.3);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 0.3rem;
    font-weight: 400;
}

.category-value {
    font-size: 0.85rem;
    color: rgba(0, 243, 255, 0.9);
    font-weight: 400;
    line-height: 1.4;
    word-break: break-word;
}

.empty-category {
    font-size: 0.8rem;
    color: rgba(224, 224, 255, 0.2);
    font-style: italic;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pagination-controls {
    margin-top: 18px;
    margin-bottom: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(224, 224, 255, 0.78);
    cursor: pointer;
    padding: 0 10px;
    font-size: 12px;
}

.page-btn.active {
    border-color: rgba(0, 243, 255, 0.46);
    color: var(--primary);
    background: rgba(0, 243, 255, 0.14);
}

.page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.page-info {
    font-size: 12px;
    color: rgba(224, 224, 255, 0.55);
}

.action-btn {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 300;
}

.action-btn-open {
    background: rgba(0, 243, 255, 0.1);
    color: var(--primary);
    border: 1px solid rgba(0, 243, 255, 0.3);
}

.action-btn-open:hover {
    background: rgba(0, 243, 255, 0.2);
    transform: translateY(-1px);
}

.action-btn-ask {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.action-btn-ask:hover {
    background: rgba(0, 255, 136, 0.2);
    transform: translateY(-1px);
}

.viewer-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 10, 0.98);
    z-index: 1000;
    display: none;
    backdrop-filter: blur(20px);
}

.viewer-container.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.viewer-overlay-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.viewer-overlay-close:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: rgba(255, 71, 87, 0.7);
}

#viewer {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-container.show {
    opacity: 1;
    pointer-events: all;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 0.8rem;
    color: var(--primary);
    font-size: 0.85rem;
    text-align: center;
    font-weight: 300;
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: rgba(224, 224, 255, 0.4);
    font-weight: 300;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.footer {
    position: relative;
    bottom: auto;
    width: 100%;
    margin: 1rem 0 1.5rem;
    text-align: center;
    color: rgba(224, 224, 255, 0.2);
    font-size: 0.75rem;
    z-index: 10;
    font-weight: 300;
}

.console-log {
    position: fixed;
    bottom: 5rem;
    right: 1.5rem;
    width: 280px;
    max-height: 180px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(0, 243, 255, 0.15);
    border-radius: 6px;
    padding: 0.8rem;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.7rem;
    overflow-y: auto;
    display: none;
    z-index: 100;
    backdrop-filter: blur(10px);
    font-weight: 300;
}

.console-log.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.log-entry {
    color: #00ff00;
    margin-bottom: 0.2rem;
    opacity: 0.7;
}

.log-time {
    color: #00f3ff;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 10, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(0, 243, 255, 0.2);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.credits-modal {
    max-width: 580px;
}

.credits-subtitle {
    margin-top: 6px;
    max-width: 420px;
    color: rgba(224, 224, 255, 0.58);
    font-size: 12px;
    line-height: 1.4;
}

.credits-security {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 243, 255, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.035);
}

.credits-security img {
    max-height: 26px;
    max-width: 96px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.credits-security span {
    color: rgba(224, 224, 255, 0.72);
    font-size: 12px;
    line-height: 1.35;
}

.credits-info {
    display: grid;
    gap: 5px;
    margin-bottom: 14px;
    padding: 12px;
    border-left: 2px solid rgba(0, 243, 255, 0.5);
    background: rgba(0, 243, 255, 0.06);
    color: rgba(224, 224, 255, 0.78);
    font-size: 13px;
    line-height: 1.45;
}

.credits-info strong {
    color: var(--light);
    font-weight: 500;
}

.credit-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 4px;
}

.credit-method {
    height: 38px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(224, 224, 255, 0.76);
    cursor: pointer;
    font: inherit;
}

.credit-method.active {
    border-color: rgba(0, 243, 255, 0.46);
    background: rgba(0, 243, 255, 0.14);
    color: var(--primary);
}

.credit-panel {
    display: none;
    margin-top: 14px;
}

.credit-panel.active {
    display: block;
}

.pix-payment-box {
    margin-top: 14px;
    text-align: center;
}

.pix-payment-box img {
    max-width: 220px;
    width: 100%;
    background: #fff;
    padding: 8px;
    border-radius: 8px;
}

.pix-payment-box textarea {
    min-height: 92px;
    margin-top: 10px;
    font-size: 12px;
}

.pix-payment-box .modal-btn {
    margin-top: 8px;
}

.credit-card-form {
    display: grid;
    gap: 10px;
}

.credit-card-form label {
    color: rgba(224, 224, 255, 0.72);
    font-size: 12px;
}

.mp-card-field {
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.mp-card-field iframe {
    width: 100% !important;
}

.credit-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.auth-tab {
    flex: 1;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(224, 224, 255, 0.75);
    cursor: pointer;
}

.auth-tab.active {
    border-color: rgba(0, 243, 255, 0.46);
    color: var(--primary);
    background: rgba(0, 243, 255, 0.12);
}

.auth-form {
    display: none;
    gap: 10px;
}

.auth-form.active {
    display: grid;
}

.auth-input {
    width: 100%;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: var(--light);
    padding: 0 12px;
    font-size: 14px;
}

.auth-input:focus {
    outline: none;
    border-color: rgba(0, 243, 255, 0.46);
}

.auth-msg {
    margin-top: 10px;
    font-size: 13px;
    color: rgba(224, 224, 255, 0.75);
    min-height: 18px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 400;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: rgba(224, 224, 255, 0.5);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 1rem;
}

.modal-btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn-primary {
    background: rgba(0, 243, 255, 0.2);
    color: var(--primary);
}

.modal-btn-primary:hover {
    background: rgba(0, 243, 255, 0.3);
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(224, 224, 255, 0.7);
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--light);
}

.document-info-modal {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 243, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.document-icon-modal {
    font-size: 1.2rem;
}

.document-name-modal {
    font-size: 0.9rem;
    color: var(--light);
    line-height: 1.4;
}

.question-input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--light);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s;
}

.question-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

.answer-content {
    color: rgba(224, 224, 255, 0.9);
    line-height: 1.6;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.answer-content strong {
    color: var(--primary);
    font-weight: 500;
}

.answer-content em {
    color: var(--accent);
    font-style: italic;
}

.error-modal {
    background: rgba(30, 20, 20, 0.95);
    border: 1px solid rgba(255, 71, 87, 0.3);
}

.error-title {
    color: #ff4757;
}

.error-icon {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.error-message {
    color: rgba(224, 224, 255, 0.8);
    text-align: center;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .title {
        font-size: 2.2rem;
        letter-spacing: 3px;
    }
    
    .instruction {
        font-size: 0.9rem;
        padding: 0 1rem;
    }
    
    .search-input {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
    }

    .top-bar {
        left: 12px;
        right: 12px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .document-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
        letter-spacing: 2px;
    }
    
    .main-container {
        padding: 5rem 1.5rem 2rem;
    }
    
    .search-container {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
    }

    .credits-security {
        flex-wrap: wrap;
    }

    .credit-card-grid {
        grid-template-columns: 1fr;
    }
}
