/* =============================================
   CUMPADRE AGRO — Design Tokens & Global Styles
   Paleta: AgroTech (Issue GL-400)
   ============================================= */

:root {
    /* === Paleta Principal (Issue GL-400) === */
    --green-dark: #1B5E20;
    --green-medium: #4CAF50;
    --green-light: #66BB6A;
    --brown: #5D4037;
    --brown-light: #795548;
    --yellow: #FBC02D;
    --gold: #C9A227;
    --gray: #616161;
    --gray-light: #9E9E9E;
    --gray-lighter: #F5F5F5;

    /* === Semantic Tokens === */
    --primary: #1B5E20;
    --primary-hover: #2E7D32;
    --primary-foreground: #ffffff;
    --secondary: #4CAF50;
    --secondary-foreground: #ffffff;
    --accent: #FBC02D;
    --accent-foreground: #1B5E20;
    --background: #ffffff;
    --foreground: #212121;
    --foreground-muted: #616161;
    --foreground-light: #9E9E9E;
    --surface: #F5F5F5;
    --surface-warm: #FFF8E1;
    --border: #E0E0E0;
    --destructive: #D32F2F;

    /* === WhatsApp Colors === */
    --whatsapp-green: #25D366;
    --whatsapp-dark: #075E54;
    --whatsapp-light: #DCF8C6;
    --whatsapp-bg: #E5DDD5;
    --whatsapp-header: #075E54;

    /* === Typography === */
    --font-family: 'Inter', 'Inter Fallback', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-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;
    --space-24: 6rem;

    /* === Border Radius === */
    --radius-sm: 0.35rem;
    --radius: 0.45rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* === Shadows === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 8px 10px rgba(0, 0, 0, 0.04);

    /* === Transitions === */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;

    /* === Layout === */
    --container-max: 1280px;
    --navbar-height: 72px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--foreground);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

ul, ol {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 700;
    color: var(--foreground);
}

/* === Container === */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-8);
    }
}

/* === Focus Styles === */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

h1:focus {
    outline: none;
}

/* === Loading Screen === */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: var(--space-4);
}

.loading-progress {
    display: block;
    width: 5rem;
    height: 5rem;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    text-align: center;
    font-weight: 600;
    color: var(--foreground-muted);
    font-size: var(--font-size-sm);
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Carregando...");
}

/* === Blazor Error UI === */
#blazor-error-ui {
    color-scheme: light only;
    background: #FFF3CD;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: var(--brown);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--destructive);
    padding: 1rem;
    color: white;
    border-radius: var(--radius);
}

.blazor-error-boundary::after {
    content: "Ocorreu um erro."
}

/* === Fade-in Animation === */
.fade-in {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}
