/* Custom Styles for NFS-e Nacional */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Glassmorphism effect */
.glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Gradient text animation */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.gradient-text-animated {
    background: linear-gradient(270deg, #0ea5e9, #8b5cf6, #0ea5e9);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 3s ease infinite;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-grid-overlay {
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 20h20v20h-20z' fill='%239CA3AF' fill-opacity='0.03'/%3E%3C/svg%3E");
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Button animations */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

/* Loading animation */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.pulse-animation {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Navbar scroll effect */
.navbar-scrolled {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Modal backdrop */
.modal-backdrop {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.notification {
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.notification-show {
    transform: translateX(0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 4px 0;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

.modal-open {
    overflow: hidden;
}

/* Document card styles */
.document-card {
    position: relative;
    overflow: hidden;
}

.document-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.document-card:hover::after {
    left: 100%;
}

/* Tooltip styles */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    font-size: 0.875rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    margin-bottom: 0.5rem;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Section divider */
.section-divider {
    position: relative;
    padding: 2rem 0;
}

.section-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

/* Floating animation */
@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0px);
    }
}

.float-animation {
    animation: float 6s ease-in-out infinite;
}

/* Text selection */
::selection {
    background: #0ea5e9;
    color: white;
}

::-moz-selection {
    background: #0ea5e9;
    color: white;
}

/* FAQ Accordion */
.faq-item {
    transition: all 0.3s ease;
}

.faq-item button i {
    transition: transform 0.3s ease;
}

.faq-item button i.rotate-180 {
    transform: rotate(180deg);
}

.faq-item>div:not(.hidden) {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   ACESSIBILIDADE (A11y - Crítico)
   ============================================ */

/* Focus styles melhorados para navegação por teclado */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #0ea5e9;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

/* Remove outline padrão mas mantém para navegação por teclado */
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* Skip to main content link para leitores de tela */
.skip-to-main {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    padding: 1rem;
    background: #0ea5e9;
    color: white;
    text-decoration: none;
}

.skip-to-main:focus {
    left: 0;
}

/* Indicador de modo de navegação por teclado */
body.user-is-tabbing *:focus {
    outline: 3px solid #0ea5e9 !important;
    outline-offset: 2px !important;
}

/* Respeita preferências de movimento reduzido */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Alto contraste para melhor legibilidade */
@media (prefers-contrast: high) {
    body {
        background: white;
        color: black;
    }

    .text-gray-600 {
        color: #333 !important;
    }
}

/* Elementos interativos devem ter área mínima de clique (44x44px) */
button,
a,
input[type="button"],
input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
    }

    a {
        color: inherit;
        text-decoration: none;
    }
}

/* Responsive utilities */
@media (max-width: 640px) {
    .container-mobile {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ============================================
   LOADING E SKELETON SCREENS (Performance/UX)
   ============================================ */

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Skeleton loading para melhor UX */
.skeleton {
    background: linear-gradient(90deg,
            #f0f0f0 25%,
            #e0e0e0 50%,
            #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Loading overlay para operações assíncronas */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-center;
    z-index: 9999;
    backdrop-filter: blur(3px);
}

/* Notification badge */
.notification-badge {
    position: relative;
}

.notification-badge::after {
    content: '';
    position: absolute;
    top: -4px;
    right: -4px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* ============================================
   RAINBOW GLOW BADGE EFFECT
   ============================================ */

/* Animação de rotação das cores rainbow */
@keyframes rainbow-glow-rotate {
    0% {
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
        filter: hue-rotate(360deg);
    }
}

/* Animação de pulso do brilho */
@keyframes rainbow-pulse {

    0%,
    100% {
        box-shadow:
            0 0 10px rgba(255, 0, 128, 0.6),
            0 0 20px rgba(255, 140, 0, 0.4),
            0 0 30px rgba(64, 224, 208, 0.3);
    }

    33% {
        box-shadow:
            0 0 15px rgba(64, 224, 208, 0.6),
            0 0 25px rgba(123, 104, 238, 0.4),
            0 0 35px rgba(0, 255, 0, 0.3);
    }

    66% {
        box-shadow:
            0 0 15px rgba(123, 104, 238, 0.6),
            0 0 25px rgba(0, 255, 0, 0.4),
            0 0 35px rgba(255, 0, 128, 0.3);
    }
}

/* Badge com efeito rainbow */
.rainbow-badge {
    position: relative;
    background: linear-gradient(135deg,
            #ff0080 0%,
            #ff8c00 20%,
            #40e0d0 40%,
            #7b68ee 60%,
            #00ff00 80%,
            #ff0080 100%) !important;
    background-size: 400% 400% !important;
    animation: rainbow-glow-rotate 6s ease infinite, rainbow-pulse 4s ease-in-out infinite !important;
    color: white !important;
    font-weight: 600 !important;
    border: none !important;
    box-shadow:
        0 0 10px rgba(255, 0, 128, 0.5),
        0 0 20px rgba(255, 140, 0, 0.3),
        0 0 30px rgba(64, 224, 208, 0.2);
}

/* Efeito extra ao passar o mouse */
.rainbow-badge:hover {
    animation: rainbow-glow-rotate 3s ease infinite, rainbow-pulse 2s ease-in-out infinite !important;
    box-shadow:
        0 0 20px rgba(255, 0, 128, 0.8),
        0 0 30px rgba(255, 140, 0, 0.6),
        0 0 40px rgba(64, 224, 208, 0.4),
        0 0 50px rgba(123, 104, 238, 0.3) !important;
    transform: scale(1.05);
}

/* ============================================
   DRAW BORDER EFFECT
   ============================================ */

/* Animação de desenho da borda */
@keyframes draw-border {
    0% {
        stroke-dashoffset: 1000;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

/* Animação de pulso da borda */
@keyframes border-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* Container do card com efeito draw border */
.draw-border-card {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* SVG overlay para a borda animada */
.draw-border-card svg {
    position: absolute;
    top: -4px;
    left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    pointer-events: none;
    z-index: 10;
}

.draw-border-card svg rect {
    fill: none;
    stroke: #ff8c00;
    stroke-width: 4;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw-border 3s ease-in-out forwards, border-pulse 2s ease-in-out infinite 3s;
    rx: 16;
}

/* Efeito de re-desenho no hover */
.draw-border-card:hover svg rect {
    animation: draw-border 1.5s ease-in-out forwards, border-pulse 1s ease-in-out infinite 1.5s;
    stroke: #ff6b00;
}

/* ============================================
   ANIMATED BORDER EFFECT (Sequential Draw)
   ============================================ */

/* Animação para borda superior e laterais */
@keyframes border-open {
    0% {
        width: 0;
        height: 0;
    }

    50% {
        width: 50%;
        height: 0;
    }

    100% {
        width: 50%;
        height: 100%;
    }
}

/* Animação para borda inferior */
@keyframes border-open-bottom {
    0% {
        width: 0;
    }

    100% {
        width: 50%;
    }
}

/* Card com borda animada sequencial */
.animated-border-card {
    position: relative;
}

/* Pseudo-elementos para as bordas superiores */
.animated-border-card::before,
.animated-border-card::after {
    content: '';
    position: absolute;
    top: -2px;
    height: 0;
    width: 0;
    display: block;
    opacity: 0;
}

.animated-border-card::before {
    left: 0;
    border-top: solid 2px #ff8c00;
    border-left: solid 2px #ff8c00;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

.animated-border-card::after {
    right: 0;
    border-top: solid 2px #ff8c00;
    border-right: solid 2px #ff8c00;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Container interno para bordas inferiores */
.border-bottom-wrap {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.border-bottom-wrap::before,
.border-bottom-wrap::after {
    content: '';
    position: absolute;
    bottom: -2px;
    height: 0;
    width: 0;
    display: block;
    opacity: 0;
}

.border-bottom-wrap::before {
    left: 0;
    border-bottom: solid 2px #ff8c00;
    border-bottom-left-radius: 12px;
}

.border-bottom-wrap::after {
    right: 0;
    border-bottom: solid 2px #ff8c00;
    border-bottom-right-radius: 12px;
}

/* Ativação das animações no hover */
.animated-border-card:hover::before,
.animated-border-card:hover::after {
    opacity: 1;
    animation: border-open 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) forwards;
}

.animated-border-card:hover .border-bottom-wrap::before,
.animated-border-card:hover .border-bottom-wrap::after {
    opacity: 1;
    height: 100%;
    animation: border-open-bottom 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) 0.4s forwards;
}

/* ============================================
   ACTIVE MENU NAVIGATION (Scroll Spy)
   ============================================ */

/* Menu link base styles */
.nav-link {
    position: relative;
    display: inline-block;
    padding-bottom: 4px;
}

/* Underline effect for active and hover states */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #8b5cf6);
    border-radius: 2px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effect - full underline */
.nav-link:hover::after {
    width: 100%;
}

/* Active state - full underline with animation */
.nav-link.active {
    color: #0ea5e9 !important;
    font-weight: 600;
}

.nav-link.active::after {
    width: 100%;
    animation: pulse-width 2s ease-in-out infinite;
}

/* Pulse animation for active state */
@keyframes pulse-width {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(14, 165, 233, 0.6);
    }

    50% {
        opacity: 0.8;
        box-shadow: 0 0 12px rgba(14, 165, 233, 0.8);
    }
}

/* Smooth hover scale effect */
.nav-link:hover {
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

/* Mobile menu active states */
@media (max-width: 1024px) {
    .nav-link::before {
        display: none;
    }

    .nav-link::after {
        left: 0;
        right: auto;
        width: 0;
    }

    .nav-link.active::after {
        width: 4px;
        height: 100%;
    }
}
