/**
 * ============================================================
 * PILATESFLOW - DESIGN SYSTEM GLOBAL
 * ============================================================
 * Este arquivo contém todas as variáveis, resets e componentes
 * base usados em todo o aplicativo.
 */

/* ─── IMPORTAÇÃO DE FONTES ──────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700&display=swap');

/* ─── VARIÁVEIS CSS (DESIGN TOKENS) ─────────────────────── */
:root {
    /* Cores principais */
    --color-white: #FFFFFF;
    --color-white-secondary: #FAFAFA;
    --color-gold: #C9A96E;
    --color-gold-light: #D4BC8B;
    --color-gold-dark: #B8914A;
    --color-gold-ultra-light: #F5F0E8;
    --color-green-dark: #1B4332;
    --color-green-dark-light: #2D5F47;
    
    /* Cores de texto */
    --color-text-primary: #2D2D2D;
    --color-text-secondary: #6B7280;
    --color-text-muted: #9CA3AF;
    
    /* Cores de estado */
    --color-success: #10B981;
    --color-success-light: #D1FAE5;
    --color-warning: #F59E0B;
    --color-warning-light: #FEF3C7;
    --color-danger: #EF4444;
    --color-danger-light: #FEE2E2;
    --color-info: #3B82F6;
    --color-info-light: #DBEAFE;
    
    /* Cores de borda */
    --color-border-light: #E5E7EB;
    --color-border-medium: #D1D5DB;
    --color-border-dark: #9CA3AF;
    
    /* Tipografia */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Poppins', sans-serif;
    
    --font-size-h1: 2.5rem;      /* 40px */
    --font-size-h2: 2rem;        /* 32px */
    --font-size-h3: 1.5rem;      /* 24px */
    --font-size-h4: 1.25rem;     /* 20px */
    --font-size-body: 1rem;      /* 16px */
    --font-size-small: 0.875rem; /* 14px */
    --font-size-caption: 0.75rem;/* 12px */
    
    /* Espaçamentos (base 8px) */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-modal: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-button: 0 2px 4px rgba(0, 0, 0, 0.1);
    
    /* Bordas */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transições */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

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

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

body {
    font-family: var(--font-body);
    font-size: var(--font-size-body);
    color: var(--color-text-primary);
    background-color: var(--color-white-secondary);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

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

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

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

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text-primary);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: var(--font-size-h4); }

/* ─── BOTÕES ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: var(--font-size-body);
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
    text-decoration: none;
    min-height: 44px; /* Acessibilidade mobile */
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--color-gold);
    color: var(--color-white);
    border-color: var(--color-gold);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-gold-dark);
    border-color: var(--color-gold-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-button);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-gold-dark);
    border-color: var(--color-gold);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--color-gold-ultra-light);
}

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

.btn-danger:hover:not(:disabled) {
    background-color: #DC2626;
    border-color: #DC2626;
}

.btn-success {
    background-color: var(--color-success);
    color: var(--color-white);
    border-color: var(--color-success);
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
    border-color: #059669;
}

.btn-ghost {
    background-color: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background-color: var(--color-white-secondary);
    color: var(--color-text-primary);
}

/* Variações de tamanho */
.btn-sm {
    padding: 8px 16px;
    font-size: var(--font-size-small);
    min-height: 36px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
    min-height: 52px;
}

.btn-block {
    width: 100%;
}

/* Estado de loading */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ─── CARDS ─────────────────────────────────────────────── */
.card {
    background-color: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.card-hover:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.card-interactive {
    cursor: pointer;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border-light);
}

.card-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-h4);
    font-weight: 600;
}

/* ─── FORMULÁRIOS ───────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-small);
    font-weight: 500;
    color: var(--color-text-primary);
}

.form-label .required {
    color: var(--color-danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: var(--font-size-body);
    color: var(--color-text-primary);
    background-color: var(--color-white);
    border: 1.5px solid var(--color-border-medium);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    min-height: 44px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--color-gold);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.15);
}

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

.form-input.error,
.form-select.error {
    border-color: var(--color-danger);
}

.form-input.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.form-error {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-size-caption);
    color: var(--color-danger);
}

.form-helper {
    display: block;
    margin-top: var(--space-xs);
    font-size: var(--font-size-caption);
    color: var(--color-text-secondary);
}

.form-input-icon {
    position: relative;
}

.form-input-icon .form-input {
    padding-left: 44px;
}

.form-input-icon .icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 1rem;
}

/* Toggle de senha */
.password-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-fast);
}

.password-toggle:hover {
    color: var(--color-text-primary);
}

/* Checkbox customizado */
.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: var(--font-size-small);
}

.form-checkbox input {
    margin-top: 2px;
    width: 18px;
    height: 18px;
    accent-color: var(--color-gold);
    cursor: pointer;
}

/* ─── BADGES ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: var(--font-size-caption);
    font-weight: 500;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-success {
    background-color: var(--color-success-light);
    color: #065F46;
}

.badge-warning {
    background-color: var(--color-warning-light);
    color: #92400E;
}

.badge-danger {
    background-color: var(--color-danger-light);
    color: #991B1B;
}

.badge-info {
    background-color: var(--color-info-light);
    color: #1E40AF;
}

.badge-neutral {
    background-color: var(--color-white-secondary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-light);
}

/* ─── MODAIS ────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.modal-active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform var(--transition-base);
}

.modal-active .modal-content {
    transform: scale(1);
}

.modal-sm {
    max-width: 400px;
}

.modal-lg {
    max-width: 700px;
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--color-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: var(--font-size-h4);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--color-white-secondary);
    color: var(--color-text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* ─── TOAST NOTIFICATIONS ───────────────────────────────── */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
}

.toast {
    background-color: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-modal);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-width: 300px;
    position: relative;
    overflow: hidden;
    transform: translateX(120%);
    transition: transform var(--transition-slow);
    border-left: 4px solid var(--color-info);
}

.toast-show {
    transform: translateX(0);
}

.toast-success { border-left-color: var(--color-success); }
.toast-error { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-info { border-left-color: var(--color-info); }

.toast i:first-child {
    font-size: 1.25rem;
}

.toast-success i:first-child { color: var(--color-success); }
.toast-error i:first-child { color: var(--color-danger); }
.toast-warning i:first-child { color: var(--color-warning); }
.toast-info i:first-child { color: var(--color-info); }

.toast-message {
    flex: 1;
    font-size: var(--font-size-small);
    color: var(--color-text-primary);
}

.toast-close {
    color: var(--color-text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.toast-close:hover {
    background-color: var(--color-white-secondary);
    color: var(--color-text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background-color: currentColor;
    opacity: 0.3;
    animation: toast-progress 5s linear forwards;
}

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ─── LOADING / SKELETON ────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-white-secondary) 0%,
        var(--color-border-light) 50%,
        var(--color-white-secondary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ─── EMPTY STATE ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.empty-state-title {
    font-size: var(--font-size-h4);
    margin-bottom: var(--space-sm);
    color: var(--color-text-primary);
}

.empty-state-text {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-lg);
}

/* ─── UTILITÁRIOS ───────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-gold { color: var(--color-gold-dark); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ─── RESPONSIVIDADE ────────────────────────────────────── */
@media (max-width: 767px) {
    :root {
        --font-size-h1: 2rem;
        --font-size-h2: 1.5rem;
        --font-size-h3: 1.25rem;
    }
    
    .toast-container {
        top: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
        max-width: none;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    .modal-content {
        max-height: 95vh;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-md);
    }
}

/* ─── SCROLLBAR CUSTOMIZADA ─────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-white-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-dark);
}