/* assets/css/style.css */
/* Estilos globais e modo escuro */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #f59e0b;
    --bg: #ffffff;
    --text: #212529;
    --muted: #6c757d;
    --card: #ffffff;
    --radius: 14px;
    --glass: rgba(255,255,255,0.6);
    --success: #16a34a;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-header: linear-gradient(135deg, #1e40af, #1e3a8a);
}

* { box-sizing: border-box; }

body {
    font-family: 'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background .2s, color .2s;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#main {
    flex: 1 0 auto;
}

a { text-decoration: none; }
.container { max-width: 1100px; padding: 0 1rem; margin: 0 auto; }

/* Header */
.gradient-header {
    background: var(--gradient-primary);
    border-bottom: 4px solid var(--secondary);
    color: white;
    padding: 1rem 0;
}
.gradient-header .display-5 {
    letter-spacing: .2px;
    font-weight: 700;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.site-title { flex: 1; text-align: left; }
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

/* Navegação */
.nav-tabs-custom .nav-link {
    color: #495057;
    font-weight: 600;
    border: none;
    padding: .75rem 1.5rem;
    transition: all 0.3s ease;
    border-radius: .375rem;
    margin: .15rem;
    background: transparent;
}
.nav-tabs-custom .nav-link.active {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
    background: rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.nav-tabs-custom .nav-link:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
}

/* Hamburger */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1000;
}
.hamburger-menu span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}
.hamburger-menu.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger-menu.active span:nth-child(2) { opacity: 0; }
.hamburger-menu.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--gradient-primary);
    padding: 80px 20px 20px;
    transition: right 0.3s ease;
    z-index: 999;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    overflow-y: auto;
}
.mobile-nav.active { right: 0; }
.mobile-nav .nav-tabs-custom { flex-direction: column; gap: 10px; }
.mobile-nav .nav-link {
    color: white !important;
    padding: 12px 15px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    font-weight: 500;
}
.mobile-nav .nav-link:hover,
.mobile-nav .nav-link.active {
    background-color: rgba(255,255,255,0.15) !important;
    border-bottom: none !important;
    transform: none !important;
}
.mobile-nav .nav-link i { margin-right: 10px; width: 20px; text-align: center; }

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
}
.overlay.active { opacity: 1; visibility: visible; }

/* Conteúdo */
.tab-content-custom {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    border: 1px solid rgba(0,0,0,0.04);
    margin-bottom: 2rem;
}
.result-container {
    border: 1px solid #dee2e6;
    border-radius: .375rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.result-header {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    padding: .75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.result-content {
    background-color: #fcfcfc;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    max-height: 420px;
    overflow-y: auto;
    white-space: pre-wrap;
    line-height: 1.6;
    padding: 1.5rem;
    transition: background .18s;
}

/* Botões */
.btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: none;
}
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    color: #fff;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.btn-outline-primary {
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Placeholders de imagem */
.image-placeholder {
    border: 1px solid #dee2e6;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}
.image-placeholder:hover { transform: translateY(-4px); }
.image-placeholder img { max-width: 100%; height: auto; display: block; }

/* Avisos */
.domain-notice {
    background: var(--gradient-primary);
    color: white;
    padding: .75rem 1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* JSON highlight */
.json-highlight { color: #0366d6; font-weight:600; }
.json-string { color: #032f62; }
.json-number { color: #e36209; }
.json-boolean { color: #6f42c1; }

/* Checkbox wrapper */
.field-checkbox {
    border: 1px solid #dee2e6;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0.6));
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.field-checkbox h6 {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Form controls */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

/* Animações */
.fade-flash { animation: flashbg .8s ease; }
@keyframes flashbg {
    from { background-color: rgba(37,99,235,0.07); }
    to { background-color: transparent; }
}

/* QR Code */
.qr-code-container {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 1rem;
}
.qr-code-image {
    max-width: 150px;
    height: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

/* Histórico */
.history-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid #e9ecef;
}
.history-item {
    background: white;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.3s ease;
}
.history-item:hover {
    background: #e3f2fd;
    border-color: var(--primary);
}
.history-item:last-child { margin-bottom: 0; }

/* Footer */
footer a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}
footer a:hover { color: #ddd; }

/* DARK MODE */
body.dark {
    --bg: #0b1220;
    --text: #e6eef8;
    --muted: #9fb2cf;
    --card: #081021;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
    background: linear-gradient(180deg,#071024,#07172b);
}
body.dark .gradient-header {
    background: linear-gradient(135deg, #222, #555);
}
body.dark .bg-white { background-color: #444 !important; }
body.dark .tab-content-custom {
    background: rgba(255,255,255,0.02);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.03);
}
body.dark .result-content {
    background: rgba(255,255,255,0.02);
    color: var(--text);
}
body.dark .nav-tabs-custom .nav-link { color: #ddd; }
body.dark .nav-tabs-custom .nav-link.active {
    color: #eee;
    border-bottom-color: rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.05);
}
body.dark .field-checkbox {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}
body.dark .history-panel {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}
body.dark .history-item {
    background: rgba(255,255,255,0.02);
    border-color: rgba(255,255,255,0.1);
}
body.dark .history-item:hover {
    background: rgba(37, 99, 235, 0.1);
}

/* DARK MODE - ajustes de contraste */
body.dark .result-header .fw-semibold {
    color: #212529;
}
body.dark .btn-outline-primary {
    border-color: #ffffff;
    color: #ffffff;
}
body.dark .btn-outline-primary:hover,
body.dark .btn-outline-primary:focus {
    background: #ffffff;
    border-color: #ffffff;
    color: #0b1220;
}
body.dark .nav-tabs-custom .nav-link:hover {
    color: #212529;
}
body.dark h2.h4.text-primary {
    color: #ffffff !important;
}

/* Responsividade */
@media (min-width:992px) {
    .mobile-nav { display: none !important; }
    .header-actions { margin-left: auto; }
}

@media (max-width:991px) {
    .desktop-nav { display: none !important; }
    .hamburger-menu { display: flex; }
    .header-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    .site-title { flex: 1; text-align: left; }
    .header-actions { display: flex; align-items: center; gap: 10px; }
    .tab-content-custom { padding: 1.5rem; }
}

@media (max-width:767px) {
    .nav-tabs-custom .nav-link { padding:.6rem .75rem; font-size:.9rem; }
    .display-5 { font-size: 1.6rem; }
    .mobile-nav { width: 100%; }
    .header-content { flex-direction: column; gap: 10px; text-align: center; }
    .site-title { text-align: center; }
    .header-actions { justify-content: center; }
    .tab-content-custom { padding: 1rem; }
    .btn { padding: 0.6rem 1.2rem; font-size: 0.9rem; }
}

/* Permite que o dropdown ultrapasse o container com overflow */
.nav-tabs-custom {
    overflow: visible !important;
}

/* Garante que o item dropdown mantenha o posicionamento relativo */
.nav-item.dropdown {
    position: relative;
}

/* Ajusta o z-index do dropdown para ficar acima do conteúdo */
.dropdown-menu {
    z-index: 1060;
}

/* ====== BANNER DE COOKIES (LGPD) ====== */
.cookie-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    padding: 16px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(120%);
    transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.05);
    pointer-events: none;
}
.cookie-banner.show {
    transform: translateY(0);
    pointer-events: auto;
}
.cookie-banner-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.cookie-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.35);
}
.cookie-banner-text {
    flex: 1;
    min-width: 240px;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.55;
}
.cookie-banner-text strong {
    color: var(--text);
    font-weight: 700;
}
.cookie-banner-text .doc-link {
    background: transparent;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.cookie-banner-text .doc-link:hover {
    color: var(--primary-dark);
}
.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.cookie-banner-actions .btn {
    padding: 10px 18px;
    font-size: 0.88rem;
}

/* Banner de cookies - modo escuro */
body.dark .cookie-banner {
    background: rgba(11, 18, 32, 0.96);
    border-top-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
}

@media (max-width: 720px) {
    .cookie-banner {
        padding: 14px 16px;
    }
    .cookie-banner-inner {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 14px;
    }
    .cookie-banner-icon {
        margin: 0 auto;
    }
    .cookie-banner-actions {
        justify-content: center;
    }
}