/* app/static/css/style.css */

:root {
    /* --- TEMA CLARO (Light Mode - Apple Style) --- */
    --mac-bg: #f5f5f7;              /* Fundo da página (Cinza suave) */
    --mac-surface: #ffffff;         /* Fundo dos Cards (Branco puro) */
    --mac-sidebar: rgba(245, 245, 247, 0.85);
    --mac-border: rgba(0, 0, 0, 0.1);
    --mac-text: #1d1d1f;            /* Preto Apple (não é #000 absoluto) */
    --mac-text-muted: #86868b;
    --mac-blue: #007aff;
    --mac-danger: #ff3b30;
    --mac-success: #34c759;
    --mac-radius: 14px;
    --mac-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
    --mac-input-bg: #ffffff;
    --mac-hover: rgba(0, 0, 0, 0.05); /* Hover suave para tabelas */
}

[data-theme="dark"] {
    /* --- TEMA ESCURO (Dark Mode - Apple Style) --- */
    --mac-bg: #1c1c1e;              /* Fundo profundo */
    --mac-surface: #2c2c2e;         /* Cards (Cinza escuro) */
    --mac-sidebar: rgba(28, 28, 30, 0.85);
    --mac-border: rgba(255, 255, 255, 0.15);
    --mac-text: #f5f5f7;            /* Texto quase branco */
    --mac-text-muted: #98989d;
    --mac-blue: #0a84ff;            /* Azul vibrante */
    --mac-danger: #ff453a;
    --mac-success: #30d158;
    --mac-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
    --mac-input-bg: #1c1c1e;
    --mac-hover: rgba(255, 255, 255, 0.1); /* Hover suave para dark mode */
}

/* --- RESET E BASE --- */
body {
    background-color: var(--mac-bg);
    color: var(--mac-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Força a cor do texto para sobrescrever o Bootstrap */
h1, h2, h3, h4, h5, h6, p, span, div, li, label {
    color: var(--mac-text);
}

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

/* --- NAVBAR (Efeito Vidro) --- */
.navbar {
    background-color: rgba(255, 255, 255, 0.8) !important; /* Fallback */
    background-color: var(--mac-surface) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--mac-border) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

/* No Dark mode, a navbar precisa ser translúcida escura */
[data-theme="dark"] .navbar {
    background-color: rgba(44, 44, 46, 0.8) !important;
}

.navbar-brand, .nav-link {
    color: var(--mac-text) !important;
    font-weight: 500;
}

.navbar-toggler {
    border-color: var(--mac-border);
    filter: invert(var(--invert-icon)); /* Ajuste automático para ícone */
}

[data-theme="dark"] { --invert-icon: 1; }
[data-theme="light"] { --invert-icon: 0; }


/* --- CARDS E CONTAINERS --- */
.card {
    background-color: var(--mac-surface);
    border: 1px solid var(--mac-border);
    border-radius: var(--mac-radius);
    box-shadow: var(--mac-shadow);
    color: var(--mac-text);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
    border-bottom: 1px solid var(--mac-border);
    background-color: transparent;
    font-weight: 600;
    color: var(--mac-text);
}

/* --- FORMULÁRIOS --- */
.form-control, .form-select {
    background-color: var(--mac-input-bg);
    border: 1px solid var(--mac-border);
    color: var(--mac-text);
    border-radius: 8px;
}

.form-control:focus, .form-select:focus {
    background-color: var(--mac-input-bg);
    color: var(--mac-text);
    border-color: var(--mac-blue);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

/* Placeholder precisa ser visível */
::placeholder {
    color: var(--mac-text-muted) !important;
    opacity: 1;
}

/* --- TABELAS (Correção Crítica do Hover) --- */
.table {
    --bs-table-color: var(--mac-text);
    --bs-table-bg: transparent;
    border-color: var(--mac-border);
}

/* Removemos o fundo preto/listrado padrão do Bootstrap e aplicamos nosso hover suave */
.table-hover tbody tr:hover > * {
    background-color: var(--mac-hover) !important;
    color: var(--mac-text) !important;
    box-shadow: none !important;
}

/* Links dentro da tabela */
.table a {
    color: var(--mac-blue);
    text-decoration: none;
    font-weight: 500;
}
.table a:hover {
    text-decoration: underline;
}

/* Cabeçalho da tabela */
.table thead th {
    border-bottom: 2px solid var(--mac-border);
    color: var(--mac-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* --- BOTÕES --- */
.btn {
    border-radius: 8px; /* Cantos arredondados estilo Apple */
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--mac-blue);
    border: none;
}
.btn-primary:hover {
    background-color: #0062cc; /* Darken manually */
    transform: translateY(-1px);
}

.btn-outline-danger {
    color: var(--mac-danger);
    border-color: var(--mac-danger);
}
.btn-outline-danger:hover {
    background-color: var(--mac-danger);
    color: #fff;
}

.btn-outline-secondary {
    color: var(--mac-text);
    border-color: var(--mac-border);
}
.btn-outline-secondary:hover {
    background-color: var(--mac-border);
    color: var(--mac-text);
}

/* --- ELEMENTOS EXTRAS (Badges, Markdown, etc) --- */

/* Badges (Etiquetas) mais suaves */
.badge {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5em 0.8em;
}
.bg-secondary {
    background-color: rgba(120, 120, 128, 0.2) !important;
    color: var(--mac-text) !important;
}

/* Ajustes para o conteúdo Markdown */
.article-content h1, .article-content h2, .article-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.article-content code {
    background-color: var(--mac-hover);
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--mac-danger);
}

.article-content pre {
    background-color: var(--mac-surface);
    border: 1px solid var(--mac-border);
    border-radius: var(--mac-radius);
    padding: 1rem;
}

/* Efeito de alerta arredondado */
.alert {
    border-radius: var(--mac-radius);
    border: 1px solid transparent;
}


/* --- IOS SEGMENTED CONTROL --- */
.ios-segmented-control {
    position: relative;
    display: inline-flex;
    background-color: rgba(118, 118, 128, 0.12); /* Cinza Apple */
    padding: 4px;
    border-radius: 9px;
    user-select: none;
    margin-bottom: 2rem;
}

.ios-segmented-control input {
    display: none;
}

.ios-segmented-control label {
    position: relative;
    z-index: 2;
    padding: 6px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--mac-text);
    transition: color 0.2s;
}

/* O retângulo branco que desliza */
.selection-highlight {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: calc(50% - 4px); /* Assume 2 botões iguais */
    background-color: var(--mac-surface);
    border-radius: 7px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1); /* Apple Easing */
    z-index: 1;
}

/* Lógica do deslize */
#modeTree:checked ~ .selection-highlight {
    transform: translateX(100%);
}

/* --- FINDER TREE VIEW --- */
.finder-card {
    border: 1px solid var(--mac-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--mac-surface);
    backdrop-filter: blur(20px);
    height: 500px; /* Altura fixa com scroll */
}

.finder-body {
    overflow-y: auto;
    max-height: 100%;
}

.finder-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Estilo dos detalhes (Categoria) */
.finder-folder details > summary {
    list-style: none;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--mac-border);
    transition: background 0.2s;
}

.finder-folder details > summary:hover {
    background-color: var(--mac-hover);
}

/* Remove a seta padrão feia e usa a nossa se precisar */
.finder-folder details > summary::-webkit-details-marker {
    display: none;
}

/* Lista de Artigos dentro da categoria */
.finder-folder ul {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0,0,0,0.02); /* Levemente mais escuro */
}

.finder-item {
    display: block;
    padding: 10px 20px 10px 45px; /* Indentação */
    color: var(--mac-text);
    text-decoration: none;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.finder-item:hover {
    background-color: var(--mac-blue);
    color: white !important;
    text-decoration: none;
}

.finder-item:hover i {
    color: white !important;
}

.small-badge {
    font-size: 0.7rem;
    opacity: 0.7;
    border-radius: 10px;
}

/* --- ANIMAÇÕES --- */
.view-container {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.view-container.active {
    opacity: 1;
    transform: translateY(0);
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}
.delay-1 { animation-delay: 0.1s; }

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


