/* ==========================================================================
   VELOCIDADE BOA - Professional Prism Design System (docs/DESIGN.md)
   ========================================================================== */

:root {
    /* Color Palette */
    --color-surface: #faf9f8;
    --color-surface-dim: #dadad9;
    --color-surface-container-lowest: #ffffff;
    --color-surface-container-low: #f4f3f2;
    --color-surface-container: #efeeed;
    --color-surface-container-high: #e9e8e7;
    --color-surface-container-highest: #e3e2e1;
    --color-on-surface: #1a1c1c;
    --color-on-surface-variant: #424752;
    --color-inverse-surface: #2f3130;
    --color-inverse-on-surface: #f1f0ef;
    --color-outline: #727783;
    --color-outline-variant: #c2c6d4;
    --color-primary: #00488d;
    --color-on-primary: #ffffff;
    --color-primary-container: #005fb8;
    --color-on-primary-container: #cadcff;
    --color-secondary: #605e5c;
    --color-on-secondary: #ffffff;
    --color-secondary-container: #e6e2df;
    --color-on-secondary-container: #666462;
    --color-error: #ba1a1a;
    --color-on-error: #ffffff;
    --color-error-container: #ffdad6;
    --color-on-error-container: #93000a;
    --color-background: #faf9f8;
    --color-on-background: #1a1c1c;

    /* Typography Scale */
    --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;

    /* Layout Spacing */
    --sidebar-width: 280px;
    --sidebar-collapsed: 64px;
    --header-height: 56px;
    --gutter: 16px;
    --margin-desktop: 24px;
    --margin-mobile: 16px;

    /* Radii */
    --radius-sm: 0.25rem;    /* 4px */
    --radius-default: 0.5rem; /* 8px */
    --radius-md: 0.75rem;    /* 12px */
    --radius-lg: 1rem;       /* 16px */
    --radius-full: 9999px;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-background);
    color: var(--color-on-background);
    min-height: 100vh;
    margin: 0;
}

/* Base Utility Classes mapping Design System */
.bg-surface { background-color: var(--color-surface) !important; }
.bg-surface-container { background-color: var(--color-surface-container) !important; }
.bg-surface-container-low { background-color: var(--color-surface-container-low) !important; }
.bg-surface-white { background-color: var(--color-surface-container-lowest) !important; }
.text-primary-prism { color: var(--color-primary) !important; }
.text-on-surface { color: var(--color-on-surface) !important; }
.text-on-surface-variant { color: var(--color-on-surface-variant) !important; }

/* Headline Typography */
.headline-xl {
    font-size: 32px;
    font-weight: 700;
    line-height: 40px;
    letter-spacing: -0.02em;
}

.headline-lg {
    font-size: 24px;
    font-weight: 600;
    line-height: 32px;
    letter-spacing: -0.01em;
}

.headline-md {
    font-size: 20px;
    font-weight: 600;
    line-height: 28px;
}

.body-lg {
    font-size: 16px;
    font-weight: 400;
    line-height: 24px;
}

.body-md {
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
}

.body-sm {
    font-size: 12px;
    font-weight: 400;
    line-height: 16px;
}

.label-md {
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.label-sm {
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.05em;
}

/* Cards & Containers */
.card-prism {
    background-color: var(--color-surface-container-lowest);
    border: 1px solid var(--color-surface-container-high);
    border-radius: var(--radius-default);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.hover-shadow:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08) !important;
    transform: translateY(-2px);
}

.transition {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hover-bg-light:hover {
    background-color: var(--color-surface-container-low) !important;
}

/* Dashboard & Sidebar Active Accent Styles */
.nav-link.active {
    border-left: 3px solid var(--color-primary-container) !important;
    background-color: rgba(0, 93, 181, 0.08) !important;
    color: var(--color-primary) !important;
    font-weight: 600;
}

.nav-link.active svg {
    color: var(--color-primary) !important;
}

.dashboard-hero-card {
    background: linear-gradient(135deg, #00366b 0%, #00488d 50%, #005fb8 100%);
    box-shadow: 0 8px 24px rgba(0, 72, 141, 0.18);
}

.kpi-card {
    border-radius: var(--radius-default);
    background-color: #ffffff;
    border: 1px solid var(--color-surface-container-high);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

.kpi-icon-wrapper {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-default);
}

/* Sidebar Layout Classes */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--color-surface-container-lowest);
    border-right: 1px solid var(--color-surface-container-high);
    transition: width 0.3s ease;
}

/* Estado Recolhido (Collapsed) da Sidebar (64px) */
.app-sidebar.collapsed {
    width: var(--sidebar-collapsed) !important;
}

.app-sidebar.collapsed .sidebar-text,
.app-sidebar.collapsed .sidebar-info,
.app-sidebar.collapsed .sidebar-label {
    display: none !important;
}

.app-sidebar.collapsed .nav-link,
.app-sidebar.collapsed .sidebar-header-button {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.app-sidebar.collapsed .nav-link svg,
.app-sidebar.collapsed .sidebar-header-button svg {
    margin-right: 0 !important;
}

/* Sidebar Custom Scrollbar */
.app-sidebar::-webkit-scrollbar {
    width: 6px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-surface-container-highest);
    border-radius: var(--radius-full);
}

.app-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-outline-variant);
}

/* Ajustes de margem do conteúdo quando sidebar recolhida */
body.sidebar-is-collapsed #appMainContent,
body.sidebar-is-collapsed #appFooter {
    margin-left: var(--sidebar-collapsed) !important;
}

/* Ad Blocks Containers */
.ad-container {
    max-width: 100%;
    overflow: hidden;
}

.ad-banner-728x90 {
    width: 100%;
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

.ad-box-250x250 {
    width: 250px;
    min-height: 250px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Redução para altura mínima (~28px) quando sem conteúdo publicitário (exibe apenas megafone e número) */
.ad-empty,
.ad-badge-only,
.ad-banner-728x90.ad-empty,
.ad-box-250x250.ad-empty,
.sidebar-ad-box.ad-empty,
.ad-container:not(:has(iframe, img, video, embed, object, script, ins, picture)),
.ad-banner-728x90:not(:has(iframe, img, video, embed, object, script, ins, picture)),
.ad-box-250x250:not(:has(iframe, img, video, embed, object, script, ins, picture)),
.sidebar-ad-box:not(:has(iframe, img, video, embed, object, script, ins, picture)) {
    min-height: 0 !important;
    height: auto !important;
    padding-top: 4px !important;
    padding-bottom: 4px !important;
}

.ad-empty .ad-footer-badge,
.ad-badge-only .ad-footer-badge,
.ad-container:not(:has(iframe, img, video, embed, object, script, ins, picture)) .ad-footer-badge,
.ad-banner-728x90:not(:has(iframe, img, video, embed, object, script, ins, picture)) .ad-footer-badge,
.ad-box-250x250:not(:has(iframe, img, video, embed, object, script, ins, picture)) .ad-footer-badge,
.sidebar-ad-box:not(:has(iframe, img, video, embed, object, script, ins, picture)) .ad-footer-badge {
    margin-top: 0 !important;
    padding-top: 2px !important;
    padding-bottom: 2px !important;
    line-height: 1 !important;
}

.ad-block iframe, 
.ad-block img {
    max-width: 100%;
    height: auto;
}

/* Sidebar Ad Blocks (250x250) */
.sidebar-ad-block {
    width: 100%;
    overflow: hidden;
}

.sidebar-ad-box {
    width: 250px;
    min-height: 250px;
    max-width: 100%;
    border-radius: var(--radius-default);
    box-sizing: border-box;
}

.sidebar-ad-box iframe,
.sidebar-ad-box img {
    max-width: 250px;
    max-height: 250px;
}

/* Oculta blocos de anúncios quando sidebar recolhida (64px) */
.app-sidebar.collapsed .sidebar-ad-block {
    display: none !important;
}

/* Responsive Handling */
@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.show-mobile {
        transform: translateX(0);
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }

    #appMainContent, #appFooter {
        margin-left: 0 !important;
    }
}

/* Ferramentas de Rede - Botões Coloridos (conforme referência visual) */
.tool-btn-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1.1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff !important;
    border-radius: var(--radius-default);
    text-decoration: none !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.tool-btn-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    filter: brightness(1.05);
    color: #ffffff !important;
}

.tool-btn-badge svg,
.tool-btn-badge i {
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Paletas de cores inspiradas no modelo */
.tool-btn-red { background-color: #ff6b6b; }
.tool-btn-blue { background-color: #3b82f6; }
.tool-btn-orange { background-color: #f59e0b; }
.tool-btn-green { background-color: #10b981; }
.tool-btn-purple { background-color: #8b5cf6; }
.tool-btn-pink { background-color: #ec4899; }
.tool-btn-cyan { background-color: #06b6d4; }

.tool-btn-header {
    padding: 0.35rem 0.85rem;
    font-size: 0.8125rem;
    line-height: 1.2;
    border-radius: 6px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tool-btn-header svg,
.tool-btn-header i {
    margin-right: 0.4rem;
}

/* ==========================================================================
   Speedometer & Speed Test Page Component Styles
   ========================================================================== */
.speedometer-container {
    position: relative;
    user-select: none;
}

.speedometer-display {
    pointer-events: none;
}

.metric-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

/* ==========================================================================
   Anúncio Flutuante YouTube (Layer Slider)
   ========================================================================== */
.yt-float-layer {
    position: fixed;
    z-index: 1055;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 1;
    transform: translateY(0) scale(1);
}

.yt-float-layer.yt-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Posições dos 4 Cantos */
.yt-pos-top-left {
    top: 76px;
    left: 24px;
}

.yt-pos-top-right {
    top: 76px;
    right: 24px;
}

.yt-pos-bottom-left {
    bottom: 24px;
    left: 24px;
}

.yt-pos-bottom-right {
    bottom: 24px;
    right: 24px;
}

/* Card & Animação de Minimizar */
.yt-float-card {
    background-color: #1a1c1c;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    transition: width 0.3s ease, height 0.3s ease;
}

.yt-float-header {
    background-color: #111313 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.yt-float-body {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 250px;
    opacity: 1;
}

.yt-float-layer.yt-minimized .yt-float-body,
.yt-float-layer.yt-minimized .yt-float-progress-container {
    display: none !important;
}

/* Responsividade Mobile (< 576px) */
@media (max-width: 576px) {
    .yt-float-layer {
        left: 12px !important;
        right: 12px !important;
        bottom: 12px !important;
        top: auto !important;
        width: auto !important;
    }
    
    .yt-float-body {
        width: 100% !important;
    }
}

/* ==========================================================================
   Geo IP Page Component Styles
   ========================================================================== */
.geoip-map-container {
    position: relative;
    border-radius: var(--radius-default);
    overflow: hidden;
}

.geoip-card-highlight {
    border-left: 4px solid var(--color-primary) !important;
}

/* ==========================================================================
   Rodapé Discreto dos Blocos de Anúncios (Ícone Megafone + Número Sequencial)
   ========================================================================== */
.ad-footer-badge {
    color: #8c8c8c;
    font-size: 11px;
    opacity: 0.65;
    font-family: var(--font-monospace, monospace);
    user-select: none;
    transition: opacity 0.2s ease;
}

.ad-footer-badge:hover {
    opacity: 0.9;
}

.ad-megaphone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #727783;
}

/* ==========================================================================
   Dashboard v1.2.0 UI/UX Components (Professional Prism)
   ========================================================================== */
.dashboard-hero-card {
    background: linear-gradient(135deg, #00366b 0%, #005fb8 100%);
    box-shadow: 0 4px 16px rgba(0, 72, 141, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

.kpi-card {
    background-color: var(--color-surface-container-lowest, #ffffff);
    border-radius: var(--radius-default, 0.5rem);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
}

.kpi-icon-wrapper {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #22c55e;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.sidebar-active-indicator {
    border-left: 3px solid var(--color-primary, #00488d) !important;
}

.recent-item-row {
    transition: background-color 0.15s ease;
}

.recent-item-row:hover {
    background-color: var(--color-surface-container-low, #f4f3f2) !important;
}

.recent-items-table th {
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-on-surface-variant, #424752);
}






