/*
 * ============================================
 * Mani Agro — Design System Global
 * Mobile-first • Verde & Branco • Clean
 * ============================================
 */

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

/* ─── CSS Custom Properties ──────────────── */
:root {
    /* Cores Primárias */
    --primary: #0F5A31;
    --primary-dark: #0A4323;
    --primary-darker: #062F17;
    --primary-light: #1A834B;
    --primary-50: #F4FAF6;
    --primary-100: #E6F4EC;
    --primary-200: #C2E5D0;
    --primary-300: #93CEAB;

    /* Superfícies */
    --surface: #FFFFFF;
    --surface-hover: #F8FAF9;
    --surface-active: #EFF2F0;
    --bg: #F4F6F5;
    --bg-elevated: #FFFFFF;

    /* Texto */
    --text: #171D1A;
    --text-secondary: #47544E;
    --text-muted: #8A9991;
    --text-inverse: #FFFFFF;

    /* Bordas */
    --border: #E1E6E3;
    --border-light: #EFF2F0;
    --border-focus: #0F5A31;

    /* Semânticas */
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --warning: #D97706;
    --warning-light: #FEF3C7;
    --success: #10B981;
    --success-light: #D1FAE5;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    /* Tipografia */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Outfit', 'Inter', sans-serif;

    /* Tamanhos */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    /* Pesos */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;

    /* Espaçamento */
    --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;

    /* Bordas arredondadas */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Sombras */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.02);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.03);
    --shadow-md: 0 12px 24px -6px rgba(15,90,49,0.05), 0 4px 8px -2px rgba(0,0,0,0.02);
    --shadow-lg: 0 20px 32px -4px rgba(15,90,49,0.08), 0 8px 16px -4px rgba(0,0,0,0.03);
    --shadow-xl: 0 28px 48px -8px rgba(15,90,49,0.12), 0 12px 24px -6px rgba(0,0,0,0.04);

    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
    --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --header-height: 56px;
    --bottom-nav-height: 64px;
    --max-width: 480px;
    --content-padding: var(--space-4);

    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-header: 300;
    --z-bottom-nav: 350;
    --z-overlay: 400;
    --z-modal: 500;
    --z-toast: 600;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

ul, ol {
    list-style: none;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

/* ─── Tipografia ─────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-bold);
    line-height: 1.2;
    color: var(--text);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }

.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary   { color: var(--primary); }
.text-danger    { color: var(--danger); }
.text-success   { color: var(--success); }
.text-center    { text-align: center; }
.text-right     { text-align: right; }

.font-medium   { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold     { font-weight: var(--font-bold); }

/* ─── Layout Utilities ───────────────────── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--content-padding);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--content-padding);
}

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

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

/* ─── Spacing ────────────────────────────── */
.m-0  { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* ─── Display ────────────────────────────── */
.hidden   { display: none !important; }
.block    { display: block; }
.inline   { display: inline; }
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

.w-full { width: 100%; }

.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }

/* ─── App Shell (com bottom nav) ─────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--content-padding);
    z-index: var(--z-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.app-header__logo {
    font-family: var(--font-heading);
    font-weight: var(--font-extrabold);
    font-size: var(--text-lg);
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.app-header__logo img,
.app-header__logo svg {
    width: 28px;
    height: 28px;
}

.app-header__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.app-content {
    flex: 1;
    padding-top: var(--header-height);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-4));
}

/* ─── Animações ──────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

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

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fade-in    { animation: fadeIn var(--transition-base) both; }
.animate-fade-in-up { animation: fadeInUp var(--transition-slow) both; }
.animate-scale-in   { animation: scaleIn var(--transition-spring) both; }
.animate-pulse      { animation: pulse 2s ease-in-out infinite; }

/* Staggered animation delays */
.delay-1 { animation-delay: 50ms; }
.delay-2 { animation-delay: 100ms; }
.delay-3 { animation-delay: 150ms; }
.delay-4 { animation-delay: 200ms; }
.delay-5 { animation-delay: 250ms; }

/* ─── Scrollbar Custom ───────────────────── */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Selection ──────────────────────────── */
::selection {
    background: var(--primary-200);
    color: var(--primary-darker);
}

/* ─── Focus Visible ──────────────────────── */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ─── Responsive ─────────────────────────── */
@media (min-width: 768px) {
    :root {
        --max-width: 640px;
        --content-padding: var(--space-6);
    }
}

@media (min-width: 1024px) {
    :root {
        --max-width: 960px;
    }
}
