/* ============================================
   PROTECT BRASIL — Design System
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
    /* Core Brand Colors */
    --pb-black: #0A0A0A;
    --pb-dark-900: #0D1117;
    --pb-dark-800: #161B22;
    --pb-dark-700: #1C2333;
    --pb-dark-600: #242D3D;
    --pb-dark-500: #2D3748;
    --pb-dark-400: #4A5568;
    --pb-dark-300: #718096;
    --pb-dark-200: #A0AEC0;
    --pb-dark-100: #CBD5E0;
    --pb-white: #F7FAFC;

    /* Accent Colors */
    --pb-emerald: #10B981;
    --pb-emerald-glow: #34D399;
    --pb-emerald-dark: #059669;
    --pb-blue: #3B82F6;
    --pb-blue-glow: #60A5FA;
    --pb-blue-dark: #2563EB;
    --pb-cyan: #06B6D4;
    --pb-amber: #F59E0B;
    --pb-amber-glow: #FBBF24;
    --pb-red: #EF4444;
    --pb-red-glow: #F87171;
    --pb-purple: #8B5CF6;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--pb-emerald) 0%, var(--pb-cyan) 100%);
    --gradient-hero: linear-gradient(135deg, var(--pb-dark-900) 0%, var(--pb-dark-700) 50%, var(--pb-dark-800) 100%);
    --gradient-card: linear-gradient(145deg, rgba(22, 27, 34, 0.8) 0%, rgba(28, 35, 51, 0.6) 100%);
    --gradient-accent: linear-gradient(135deg, var(--pb-emerald) 0%, var(--pb-blue) 100%);
    --gradient-danger: linear-gradient(135deg, var(--pb-red) 0%, #DC2626 100%);
    --gradient-warning: linear-gradient(135deg, var(--pb-amber) 0%, #D97706 100%);

    /* Glass Effect */
    --glass-bg: rgba(22, 27, 34, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 20px;
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-base: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 1.875rem;
    --font-4xl: 2.25rem;
    --font-5xl: 3rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-base);
    line-height: 1.6;
    color: var(--pb-dark-100);
    background: var(--pb-dark-900);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(16, 185, 129, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: var(--pb-emerald);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--pb-emerald-glow);
}

img {
    max-width: 100%;
    height: auto;
}

/* ---- Shared Header / Navigation ---- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: var(--space-3) 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
}

.header-brand img {
    max-height: 55px;
    width: auto;
    object-fit: contain;
    filter: invert(1) hue-rotate(180deg) brightness(1.3);
}

.header-brand .brand-text {
    display: flex;
    flex-direction: column;
}

.header-brand .brand-name {
    font-size: var(--font-lg);
    font-weight: 800;
    color: var(--pb-white);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.header-brand .brand-sub {
    font-size: var(--font-xs);
    color: var(--pb-dark-300);
    font-weight: 500;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.header-nav .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--pb-dark-200);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.header-nav .nav-link:hover,
.header-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--pb-white);
}

.header-nav .nav-link.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--pb-emerald-glow);
}


/* ---- Utility Classes ---- */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    position: relative;
    z-index: 1;
}

.text-gradient {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Glass Card Component ---- */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    transition: all var(--transition-base);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--glass-shadow), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-family);
    font-size: var(--font-sm);
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-glow-emerald);
}

.btn-primary:hover {
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background: var(--pb-dark-600);
    color: var(--pb-dark-100);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: var(--pb-dark-500);
    border-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-danger:hover {
    box-shadow: var(--shadow-glow-red);
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}

.btn-whatsapp:hover {
    background: #20BD5A;
    box-shadow: 0 0 20px rgba(37, 211, 102, 0.4);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-base);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--pb-emerald-glow);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--pb-amber-glow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--pb-red-glow);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--pb-blue-glow);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ---- Stat Card ---- */
.stat-card {
    padding: var(--space-6);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-xl);
    margin-bottom: var(--space-4);
}

.stat-card .stat-value {
    font-size: var(--font-3xl);
    font-weight: 800;
    color: var(--pb-white);
    line-height: 1.2;
    margin-bottom: var(--space-1);
}

.stat-card .stat-label {
    font-size: var(--font-sm);
    color: var(--pb-dark-300);
    font-weight: 500;
}

.stat-card .stat-change {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--font-xs);
    font-weight: 600;
    margin-top: var(--space-2);
}

.stat-change.positive { color: var(--pb-emerald-glow); }
.stat-change.negative { color: var(--pb-red-glow); }

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
}

thead th {
    text-align: left;
    padding: var(--space-4) var(--space-4);
    font-weight: 600;
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pb-dark-300);
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--pb-dark-100);
    white-space: nowrap;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ---- Section Titles ---- */
.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.section-title h2 {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--pb-white);
}

.section-title .icon {
    font-size: var(--font-2xl);
}

.section-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--glass-border), transparent);
    margin: var(--space-8) 0;
}

/* ---- Score Bar ---- */
.score-bar {
    width: 100%;
    height: 8px;
    background: var(--pb-dark-600);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.score-bar .score-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
}

.score-fill.excellent { background: var(--gradient-accent); }
.score-fill.good { background: var(--pb-blue); }
.score-fill.warning { background: var(--pb-amber); }
.score-fill.danger { background: var(--pb-red); }

/* ---- Trend Indicator ---- */
.trend-up { color: var(--pb-emerald-glow); }
.trend-down { color: var(--pb-red-glow); }
.trend-neutral { color: var(--pb-dark-300); }

.trend-arrow {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--font-xs);
    font-weight: 600;
}

/* ---- Animations ---- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); }
    50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.4); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fade-in {
    animation: fadeIn var(--transition-slow) ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slow) ease-out forwards;
}

.animate-slide-in-right {
    animation: slideInRight var(--transition-slow) ease-out forwards;
}

/* Stagger children animations */
.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.5s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--pb-dark-800);
}

::-webkit-scrollbar-thumb {
    background: var(--pb-dark-500);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--pb-dark-400);
}

/* ---- Mobile-First Enhancements ---- */

/* Touch-friendly minimum sizes */
@media (pointer: coarse) {
    .btn, .filter-btn, .action-btn, .nav-link {
        min-height: 44px;
        min-width: 44px;
    }
    
    select {
        min-height: 44px;
        font-size: 16px !important; /* Prevents iOS zoom */
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile */
@media (max-width: 768px) {
    body {
        font-size: var(--font-sm);
    }

    /* Header: compact on mobile */
    .header-inner { 
        padding: 0 var(--space-3); 
    }

    .header-brand img {
        max-height: 45px;
    }
    
    .header-brand .brand-text { 
        display: none; 
    }

    .header-nav .nav-text { 
        display: none; 
    }

    .header-nav .nav-link {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-lg);
    }

    .container { 
        padding: 0 var(--space-3); 
    }

    .grid-4, .grid-3, .grid-2 { 
        grid-template-columns: 1fr; 
    }

    .hide-mobile { 
        display: none !important; 
    }

    /* Stat cards: 2-column grid on mobile */
    .stat-card {
        padding: var(--space-4);
    }

    .stat-card .stat-icon {
        width: 36px;
        height: 36px;
        font-size: var(--font-base);
        margin-bottom: var(--space-2);
    }

    .stat-card .stat-value { 
        font-size: var(--font-xl); 
    }

    .stat-card .stat-label {
        font-size: var(--font-xs);
    }

    /* Glass card: reduce transform on mobile (avoids jank) */
    .glass-card:hover {
        transform: none;
    }

    /* Buttons: full width on mobile */
    .btn-lg {
        width: 100%;
        padding: var(--space-4);
        font-size: var(--font-sm);
    }

    /* Badges: slightly larger for readability */
    .badge {
        font-size: 11px;
        padding: var(--space-1) var(--space-2);
    }

    /* Tables: compact */
    thead th {
        padding: var(--space-2) var(--space-3);
        font-size: 10px;
    }

    tbody td {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-xs);
    }

    /* Section titles */
    .section-title h2 {
        font-size: var(--font-base);
    }

    .section-title .icon {
        font-size: var(--font-lg);
    }

    .section-divider {
        margin: var(--space-6) 0;
    }
}

/* Ultra small screens (iPhone SE, etc) */
@media (max-width: 375px) {
    .container {
        padding: 0 var(--space-2);
    }

    .stat-card .stat-value {
        font-size: var(--font-lg);
    }

    .btn-lg {
        font-size: var(--font-xs);
    }

    thead th {
        padding: var(--space-1) var(--space-2);
    }

    tbody td {
        padding: var(--space-1) var(--space-2);
        font-size: 11px;
    }
}

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