/**
 * Design System Global - ERP SeuNutricionista
 * Paleta unificada slate profissional
 */

/* ===========================
   CSS VARIABLES
   =========================== */
:root {
    /* Primary - Slate Profissional */
    --primary: #1e293b;
    --primary-dark: #0f172a;
    --primary-darker: #0a0f1a;
    --primary-light: #f1f5f9;
    --primary-lighter: #f8fafc;
    --primary-hover: #0f172a;
    --primary-rgb: 30, 41, 59;

    /* Grayscale */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --white: #ffffff;

    /* Semantic Colors */
    --success: #16a34a;
    --success-light: #dcfce7;
    --success-dark: #15803d;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --danger-dark: #b91c1c;
    --warning: #ca8a04;
    --warning-light: #fef3c7;
    --warning-dark: #a16207;
    --info: #1e293b;
    --info-light: #f1f5f9;
    --purple: #7c3aed;
    --purple-light: #ede9fe;
    --pink: #db2777;
    --pink-light: #fce7f3;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --radius-xl: 12px;
    --radius-full: 9999px;
}

/* ===========================
   RESET / BASE
   =========================== */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===========================
   TYPOGRAPHY
   =========================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
}

label, .form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray-700);
}

small {
    font-size: 0.75rem;
}

/* ===========================
   BUTTONS
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    line-height: 1.4;
    min-height: 38px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.25);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
}

.btn-success:hover {
    background: var(--success-dark);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-dark);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    min-height: 32px;
}

.btn-lg {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    min-height: 44px;
}

/* ===========================
   CARDS
   =========================== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 1rem;
}

/* ===========================
   FORM INPUTS
   =========================== */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
    min-height: 42px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    width: 100%;
}

.form-control:hover,
input:hover,
select:hover,
textarea:hover {
    border-color: var(--gray-300);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

textarea {
    min-height: 80px;
    resize: vertical;
}

/* ===========================
   TABLES
   =========================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===========================
   BADGES
   =========================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

/* ===========================
   ANIMATIONS
   =========================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease forwards;
}

.animate-slideIn {
    animation: slideIn 0.3s ease forwards;
}

/* ===========================
   TOAST NOTIFICATIONS
   =========================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 0.875rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    min-width: 280px;
    animation: slideInRight 0.3s ease;
    border-left: 4px solid var(--primary);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* ===========================
   UTILITY CLASSES
   =========================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }

.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.w-full { width: 100%; }
.hidden { display: none; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===========================
   MEDIA QUERIES
   =========================== */
@media (max-width: 480px) {
    body {
        font-size: 0.875rem;
    }

    .btn {
        min-height: 44px;
        font-size: 0.875rem;
    }

    input, select, textarea {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media (max-width: 768px) {
    .card-body {
        padding: 0.75rem;
    }
}
