:root {
    --bg-primary: #070b1e;
    --bg-secondary: #0f1629;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(15, 22, 41, 0.55);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    --card-hover: rgba(59, 130, 246, 0.1);
}

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

html, body {
    min-height: 100vh;
}

body {
    font-family: "Inter", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Orbs de fundo com blur */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}
.orb-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
    top: -150px; left: -100px;
    animation: float 20s ease-in-out infinite;
}
.orb-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
    top: 40%; right: -100px;
    animation: float 25s ease-in-out infinite reverse;
}
.orb-3 {
    width: 350px; height: 350px;
    background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
    bottom: -100px; left: 30%;
    animation: float 22s ease-in-out infinite;
}
.orb-4 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #6366f1 0%, transparent 70%);
    top: 20%; left: 50%;
    animation: float 18s ease-in-out infinite reverse;
}

@keyframes float {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(40px, -60px) rotate(2deg); }
    50%  { transform: translate(-30px, -20px) rotate(-1deg); }
    75%  { transform: translate(20px, 50px) rotate(1deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* Grid sutil de fundo */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}
.container-fluid {
    width: 100%;
    padding: 20px 40px;
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Header com imagem de fundo */
header {
    background: url('../img/fundo2.png') center/cover no-repeat;
    color: var(--text-primary);
    padding: 20px 0;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
    min-height: 120px;
    display: flex;
    align-items: center;
}
header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(7, 11, 30, 0.7);
    z-index: 0;
}
header .container {
    position: relative;
    z-index: 1;
    width: 100%;
}
header h1 {
    font-size: clamp(1.9rem, 8vw, 3.6rem);
    font-weight: 400;
    font-family: "Moon Dance", cursive;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
header a {
    color: inherit;
    text-decoration: none;
}

/* Search box glass */
.search-box {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-bottom: 30px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}
.search-box::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent 50%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.search-box form {
    display: flex;
    gap: 12px;
    align-items: stretch;
}
.search-box select {
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 180px;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
    -moz-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='%2394a3b8' stroke-width='3' 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 16px center;
}
.search-box select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-box select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.search-box input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    transition: all 0.2s;
}
.search-box input[type="text"]::placeholder {
    color: var(--text-secondary);
}
.search-box input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-box button {
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.search-box button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}
.search-hint {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Post-it link - Você conhece a verdade? */
.post-it-link {
    position: absolute;
    top: -58px;
    right: 60px;
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
    color: #713f12;
    font-family: "Moon Dance", cursive;
    font-size: 1.15rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 2px;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.3), inset 0 -2px 0 rgba(0,0,0,0.05);
    transform: rotate(-3deg);
    z-index: 2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: floatPostIt 3s ease-in-out infinite;
    line-height: 1.2;
    border: none;
    cursor: pointer;
}

.post-it-link::before {
    content: '';
    position: absolute;
    top: 4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: rgba(254, 249, 195, 0.5);
    z-index: -1;
    transform: rotate(2deg);
    border-radius: 2px;
    box-shadow: 1px 2px 6px rgba(0,0,0,0.2);
}

@keyframes floatPostIt {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50% { transform: rotate(-2deg) translateY(-6px); }
}

.post-it-link:hover {
    transform: rotate(0deg) translateY(-2px) scale(1.05);
    box-shadow: 3px 6px 15px rgba(0,0,0,0.4);
}

@media (max-width: 768px) {
    .post-it-link {
        font-size: 1rem;
        padding: 8px 14px;
        top: -50px;
        right: 20px;
    }
}

.stats {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}
.stats h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text-secondary);
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}
.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--glass-highlight);
    border-radius: 10px;
    border: 1px solid var(--glass-border);
}
.stat-item .number {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--accent-light), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-item .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Results grid */
.results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 1;
}

/* Glass card */
.result-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    overflow: hidden;
    min-height: 140px;
    position: relative;
}
.result-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent 50%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}
.result-card:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.15);
}
.result-thumbnail {
    flex-shrink: 0;
    width: 160px;
    min-height: 100%;
    position: relative;
    background: #000;
    overflow: hidden;
}
.result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.result-card:hover .result-thumbnail img {
    transform: scale(1.05);
}
.result-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.result-content h3 {
    font-size: 1rem;
    margin-bottom: 6px;
    line-height: 1.3;
}
.result-content h3 a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.2s;
}
.result-content h3 a:hover {
    color: #a78bfa;
    text-decoration: underline;
}
.result-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.result-meta em {
    font-style: italic;
    opacity: 0.7;
}
.result-text {
    background: rgba(0, 0, 0, 0.25);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
    flex: 1;
    overflow-wrap: break-word;
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.03);
}
.result-text mark {
    background: rgba(251, 191, 36, 0.3);
    color: #fde68a;
    padding: 2px 4px;
    border-radius: 3px;
}
.timestamp-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #FF0000;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    min-width: 0;
}
.timestamp-badge:hover {
    background: #CC0000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.4);
}
.timestamp-badge svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.card-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}
.card-actions > * {
    flex: 1 1 0%;
    justify-content: center;
    min-width: 0;
    margin-top: 0 !important;
}
.copy-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
}
.copy-link-btn:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
}
.copy-link-btn.copied {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.3);
}

.load-more {
    text-align: center;
    padding: 30px 0;
    position: relative;
    z-index: 1;
}
.load-more button {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.load-more button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}
.load-more button:disabled {
    background: #374151;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.throttle-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fde68a;
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    position: relative;
    z-index: 1;
}
.empty-state h2 {
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

footer {
    margin-top: 40px;
    padding: 20px 40px;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    z-index: 1;
}
.footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.footer-copy {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.2s;
    font-size: 0.9rem;
}
.footer-links a:hover {
    color: var(--accent-light);
}

/* Canal badge */
.canal-badge {
    display: inline-block;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 5px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    letter-spacing: 0.02em;
}

/* Search meta */
.search-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
}

/* Aviso Legal link */
#aviso-legal-link {
    color: #fbbf24;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed rgba(251, 191, 36, 0.5);
    transition: opacity 0.2s;
    white-space: nowrap;
}
#aviso-legal-link:hover {
    opacity: 0.8;
}
.link-destaque {
    color: #fbbf24;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed rgba(251, 191, 36, 0.5);
    transition: opacity 0.2s;
}
.link-destaque:hover {
    opacity: 0.8;
}

/* Modal Aviso Legal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 11, 30, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active {
    display: flex;
}
.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
}
.modal-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}
.modal-close:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
}
.modal-body {
    padding: 20px 24px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}
.modal-body p {
    margin: 0;
}
.modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}
.modal-btn-fechar {
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.modal-btn-fechar:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* Stats table */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}
.stats-table thead tr {
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--glass-border);
}
.stats-table th {
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    color: var(--accent-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stats-table tbody tr {
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.2s;
}
.stats-table tbody tr:last-child {
    border-bottom: none;
}
.stats-table tbody tr:hover {
    background: var(--card-hover);
}
.stats-table td {
    padding: 12px 20px;
    color: var(--text-primary);
}
.stats-table td.rank {
    font-weight: 700;
    color: var(--accent-light);
    font-size: 0.9rem;
}
.stats-table td.palavra {
    font-weight: 600;
}
.stats-table td.canal {
    color: var(--text-secondary);
}
.stats-table td.canal em {
    opacity: 0.6;
}
.stats-table td.quantidade {
    text-align: center;
    font-weight: 700;
    color: var(--accent-light);
}

@media (max-width: 768px) {
    header {
        background-position: right center;
    }
    .container-fluid {
        padding: 10px 15px;
    }
    .search-box form {
        flex-direction: column;
    }
    .search-box select {
        width: 100%;
    }
    .results {
        grid-template-columns: 1fr;
    }
    .result-card {
        flex-direction: column;
        min-height: auto;
    }
    .result-thumbnail {
        width: 100%;
        height: 160px;
        min-height: auto;
    }
    .result-thumbnail img {
        object-fit: cover;
        object-position: center;
    }
    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    .footer-links {
        order: -1;
    }
    .stats-table th,
    .stats-table td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    .stats-table th {
        font-size: 0.75rem;
    }
    .pwa-banner-inner {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* PWA Install Banner */
.pwa-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 14px 20px;
    z-index: 999;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.4s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.pwa-banner-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}
.pwa-banner-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    flex: 1;
}
.pwa-install-btn {
    padding: 8px 20px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    white-space: nowrap;
}
.pwa-install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}
.pwa-dismiss-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}
.pwa-dismiss-btn:hover {
    color: var(--text-primary);
}
