/* ============================================================
   NUTRIÇÃO ESPORTIVA - CSS CUSTOMIZADO
   Complementa o Tailwind CSS com estilos específicos
   ============================================================ */

/* ============================================================
   1. VARIÁVEIS
   ============================================================ */
:root {
    --brand-500: #22c55e;
    --brand-600: #16a34a;
    --brand-700: #15803d;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: 'Merriweather', Georgia, serif;
    --transition: 200ms ease;
    --radius: 1rem;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

/* ============================================================
   2. RESET E BASE
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Foco acessível */
:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
}

/* Imagens responsivas */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================================
   3. TIPOGRAFIA DE ARTIGOS
   Estilo editorial profissional para o conteúdo do blog
   ============================================================ */
.article-content {
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    line-height: 1.75;
    color: #374151;
}

.article-content h2 {
    font-family: var(--font-sans);
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.3;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0fdf4;
}

.article-content h3 {
    font-family: var(--font-sans);
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.article-content h4 {
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    font-weight: 600;
    color: #374151;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.article-content p {
    margin-bottom: 1.25rem;
}

.article-content strong {
    font-weight: 700;
    color: #111827;
}

.article-content em {
    font-style: italic;
    color: #6b7280;
}

.article-content ul,
.article-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
    space-y: 0.5rem;
}

.article-content ul {
    list-style-type: disc;
}

.article-content ol {
    list-style-type: decimal;
}

.article-content li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.article-content blockquote {
    border-left: 4px solid var(--brand-500);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    background: #f0fdf4;
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
    color: #374151;
}

.article-content blockquote cite {
    font-style: normal;
    font-size: 0.875rem;
    color: #6b7280;
    display: block;
    margin-top: 0.5rem;
}

.article-content a {
    color: var(--brand-600);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color var(--transition);
}

.article-content a:hover {
    text-decoration-color: var(--brand-600);
}

/* Tabelas nos artigos */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9375rem;
    font-family: var(--font-sans);
}

.article-content th {
    background: #f0fdf4;
    border: 1px solid #d1fae5;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #166534;
}

.article-content td {
    border: 1px solid #e5e7eb;
    padding: 0.625rem 1rem;
    color: #374151;
}

.article-content tr:nth-child(even) td {
    background: #f9fafb;
}

/* Código nos artigos */
.article-content code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875em;
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    color: #e53e3e;
}

.article-content pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 1.25rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Imagens dentro dos artigos */
.article-content img {
    border-radius: 0.75rem;
    margin: 1.5rem auto;
    box-shadow: var(--shadow-md);
}

.article-content figure {
    margin: 1.5rem 0;
    text-align: center;
}

.article-content figcaption {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
    font-family: var(--font-sans);
    font-style: italic;
}

/* Caixas de destaque nos artigos */
.article-content .info-box,
.article-content .tip-box,
.article-content .warning-box {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
}

.article-content .info-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}

.article-content .tip-box {
    background: #f0fdf4;
    border-left: 4px solid var(--brand-500);
}

.article-content .warning-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
}

/* ============================================================
   4. ANIMAÇÕES
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-gentle {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.animate-slide-in {
    animation: slideIn 0.3s ease forwards;
}

.animate-pulse-gentle {
    animation: pulse-gentle 2s ease-in-out infinite;
}

/* ============================================================
   5. COMPONENTES
   ============================================================ */

/* Cards de artigo com hover state */
.post-card {
    transition: transform var(--transition), box-shadow var(--transition);
}

.post-card:hover {
    transform: translateY(-2px);
}

/* Breadcrumb */
.breadcrumb-nav {
    font-size: 0.875rem;
}

/* Line clamp (compatibilidade) */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ============================================================
   6. CHAT DA IA
   ============================================================ */
#chat-messages {
    scroll-behavior: smooth;
}

.chat-message {
    animation: fadeIn 0.3s ease;
}

/* Estilos do markdown renderizado no chat */
.chat-message .prose-sm strong {
    font-weight: 600;
}

.chat-message .prose-sm li {
    margin-left: 1rem;
    list-style: disc;
}

/* ============================================================
   7. FORMULÁRIOS
   ============================================================ */
.newsletter-form input[type="email"]:focus {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* ============================================================
   8. ADMIN
   ============================================================ */
.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
    transition: background-color var(--transition), color var(--transition);
}

.admin-sidebar-link:hover,
.admin-sidebar-link.active {
    background-color: #f0fdf4;
    color: var(--brand-700);
}

/* ============================================================
   9. UTILITÁRIOS EXTRAS
   ============================================================ */

/* Gradiente de texto */
.gradient-text {
    background: linear-gradient(135deg, var(--brand-500), #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Scroll bar customizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Seleção de texto */
::selection {
    background: #bbf7d0;
    color: #166534;
}

/* ============================================================
   10. RESPONSIVO
   ============================================================ */
@media (max-width: 640px) {
    .article-content {
        font-size: 1rem;
    }

    .article-content h2 {
        font-size: 1.375rem;
    }

    .article-content table {
        font-size: 0.875rem;
    }

    .article-content th,
    .article-content td {
        padding: 0.5rem 0.75rem;
    }
}

/* ============================================================
   11. PRINT
   ============================================================ */
@media print {
    header, footer, aside, nav, #chat-form, .newsletter-form {
        display: none !important;
    }

    .article-content {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
    }

    a[href]:after {
        content: ' (' attr(href) ')';
        font-size: 10pt;
        color: #666;
    }
}
