/* ============================================================
   GLOBAL.CSS - Reset, Variáveis, Tipografia e Utilitários
   Recarga Fácil - Design System
   ============================================================ */

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

/* ----- CSS Variables ----- */
:root {
    /* Cores principais */
    --color-primary: #667eea;
    --color-primary-dark: #5a67d8;
    --color-accent: #764ba2;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-primary-hover: linear-gradient(135deg, #5a67d8 0%, #6b3fa0 100%);

    /* Sidebar */
    --sidebar-bg: #1e1e2f;
    --sidebar-hover: #2d2d44;
    --sidebar-active: #3d3d5c;
    --sidebar-text: #a0aec0;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;

    /* Superfícies */
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-hover: #fafbfc;

    /* Texto */
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #a0aec0;
    --text-white: #ffffff;

    /* Bordas */
    --border-light: #e2e8f0;
    --border-input: #cbd5e0;

    /* Status */
    --color-success: #48bb78;
    --color-success-bg: #f0fff4;
    --color-success-text: #276749;
    --color-danger: #f56565;
    --color-danger-bg: #fff5f5;
    --color-danger-text: #9b2c2c;
    --color-warning: #ed8936;
    --color-warning-bg: #fffaf0;
    --color-warning-text: #9c4221;
    --color-info: #4299e1;
    --color-info-bg: #ebf8ff;
    --color-info-text: #2b6cb0;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);

    /* Bordas arredondadas */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transições */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ----- Dark Theme ----- */
[data-theme="dark"] {
    /* Superfícies */
    --bg-body: #0f1117;
    --bg-card: #1a1d27;
    --bg-card-hover: #22252f;

    /* Texto */
    --text-primary: #e8eaed;
    --text-secondary: #a8adb8;
    --text-muted: #6b7280;

    /* Bordas */
    --border-light: #2a2d37;
    --border-input: #3a3d47;

    /* Sidebar (já é escura, mas ajustar pro dark) */
    --sidebar-bg: #111318;
    --sidebar-hover: #1e2030;
    --sidebar-active: #2a2d44;

    /* Status — backgrounds adaptados para dark */
    --color-success-bg: rgba(72, 187, 120, 0.12);
    --color-success-text: #68d391;
    --color-danger-bg: rgba(245, 101, 101, 0.12);
    --color-danger-text: #fc8181;
    --color-warning-bg: rgba(237, 137, 54, 0.12);
    --color-warning-text: #f6ad55;
    --color-info-bg: rgba(66, 153, 225, 0.12);
    --color-info-text: #63b3ed;

    /* Sombras mais sutis no dark */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* Smooth transition ao trocar tema */
html[data-theme] body,
html[data-theme] .sidebar,
html[data-theme] .topbar,
html[data-theme] .card,
html[data-theme] .modal,
html[data-theme] .stat-card {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ----- Theme Toggle Button ----- */
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: transparent;
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.theme-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* Floating theme toggle (login/register) */
.theme-toggle-float {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 50;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
}

.theme-toggle-float:hover {
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

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

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

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

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

/* ----- Tipografia ----- */
h1 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

h4 {
    font-size: 1.125rem;
    font-weight: 500;
    line-height: 1.4;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-muted {
    color: var(--text-muted);
}

.text-secondary {
    color: var(--text-secondary);
}

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

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

/* ----- Utilitários ----- */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: 8px;
}

.gap-md {
    gap: 16px;
}

.gap-lg {
    gap: 24px;
}

.mt-sm {
    margin-top: 8px;
}

.mt-md {
    margin-top: 16px;
}

.mt-lg {
    margin-top: 24px;
}

.mb-sm {
    margin-bottom: 8px;
}

.mb-md {
    margin-bottom: 16px;
}

.mb-lg {
    margin-bottom: 24px;
}

/* ----- Animações ----- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

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

    to {
        transform: rotate(360deg);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-fade-in-scale {
    animation: fadeInScale 0.3s ease-out;
}

.animate-slide-in {
    animation: slideInLeft 0.3s ease-out;
}

/* ----- Loading skeleton ----- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: pulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

/* ----- Spinner ----- */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}