/* TSU Investimentos - Estilos */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --header-bg: #479BDF;
    --primary: #479BDF;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f3f4f6;
    --white: #ffffff;
    --border: #e5e7eb;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

body.dark {
    --header-bg: #365C7D;
    --primary: #5ba3d9;
    --text: #e5e7eb;
    --text-light: #9ca3af;
    --bg: #1f2937;
    --white: #374151;
    --border: #4b5563;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }

/* Header */
.header {
    background: var(--header-bg);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo { display: flex; align-items: baseline; gap: 0.25rem; text-decoration: none; }
.logo-text { font-size: 1.5rem; font-weight: 700; color: #fff; }
.logo-sub { font-size: 0.875rem; color: rgba(255,255,255,0.8); }

.header-right { display: flex; align-items: center; gap: 1.5rem; }

.nav { display: flex; gap: 1.5rem; }
.nav-link { color: #fff; font-weight: 500; padding: 0.5rem 0; opacity: 0.9; }
.nav-link:hover, .nav-link.active { opacity: 1; text-decoration: none; }
.nav-app { background: rgba(255,255,255,0.2); padding: 0.4rem 0.8rem; border-radius: 4px; margin-left: 0.5rem; }
.nav-app:hover { background: rgba(255,255,255,0.3); }

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    color: #fff;
    opacity: 0.9;
}
.theme-toggle:hover { opacity: 1; }

/* Main */
.main { padding: 2rem 0; }

/* Sections - Padronizadas */
.section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
}

.section-link { font-size: 0.875rem; }
.section-badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    background: rgba(71, 155, 223, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
}

.section-disclaimer {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-style: italic;
}

/* Search */
.search-section { margin-bottom: 1.5rem; }
.search-box { display: flex; gap: 0.5rem; max-width: 500px; }
.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--white);
    color: var(--text);
}
.search-input:focus { border-color: var(--primary); outline: none; }
.search-btn {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* News Card */
.news-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.news-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.news-fonte {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
}

.news-data {
    font-size: 0.75rem;
    color: var(--text-light);
}

.news-titulo {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-titulo a { color: inherit; }
.news-titulo a:hover { color: var(--primary); }

.news-resumo {
    font-size: 0.875rem;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-ativos { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.news-ativo-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(71, 155, 223, 0.1);
    color: var(--primary);
}

/* News List (Dicas/Twitter) */
.news-list { display: flex; flex-direction: column; gap: 0.75rem; }

.news-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.news-item-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.news-item-titulo {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    line-height: 1.4;
}

.news-item-titulo a { color: inherit; }
.news-item-titulo a:hover { color: var(--primary); }

/* Badge */
.badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}
.badge-breaking { background: #ef4444; color: #fff; }
.badge-dica { background: #f59e0b; color: #fff; }

/* Twitter Feed */
.twitter-feed { display: flex; flex-direction: column; gap: 0.75rem; }

.tweet-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.tweet-item.breaking { border-left: 3px solid #ef4444; }

.tweet-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.tweet-fonte { font-size: 0.8rem; font-weight: 600; color: var(--primary); }
.tweet-data { font-size: 0.75rem; color: var(--text-light); }

.tweet-text {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.5;
}

.tweet-text a { color: inherit; }

/* Ativos Grid */
.ativos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

.ativo-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    text-decoration: none;
}

.ativo-card:hover { border-color: var(--primary); text-decoration: none; }

.ativo-ticker { font-size: 1rem; font-weight: 700; color: var(--primary); }
.ativo-nome { font-size: 0.75rem; color: var(--text-light); margin-top: 0.25rem; }
.ativo-count { font-size: 0.75rem; color: var(--text-light); margin-top: 0.5rem; }

/* Footer */
.footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 2rem;
}

.footer p { text-align: center; font-size: 0.875rem; color: var(--text-light); }

/* Utilities */
.loading, .empty-state { text-align: center; padding: 2rem; color: var(--text-light); }
.error { background: #fee2e2; color: #991b1b; padding: 1rem; border-radius: var(--radius); text-align: center; }
.hidden { display: none !important; }

/* Layout com Sidebar */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
}

.main-content { min-width: 0; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 1rem; }

.sidebar-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1rem;
}

.sidebar-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.sidebar-list { display: flex; flex-direction: column; gap: 0.5rem; }

.sidebar-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.813rem;
}

.sidebar-ticker {
    font-weight: 600;
    color: var(--primary);
}

.sidebar-valor {
    font-weight: 500;
    color: var(--text);
}

.sidebar-info {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Sidebar Internacional */
.sidebar-internacional {
    display: grid;
    grid-template-columns: 18px 1fr auto auto;
    gap: 0.35rem;
    align-items: center;
    padding: 0.25rem 0.4rem;
}

.sidebar-flag {
    width: 18px;
    height: 12px;
    object-fit: cover;
    border-radius: 2px;
}

.sidebar-nome {
    font-size: 0.7rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-valor {
    font-size: 0.7rem;
}

.sidebar-variacao {
    font-size: 0.7rem;
    font-weight: 600;
    min-width: 50px;
    text-align: right;
}

.variacao-positiva { color: #10b981; }
.variacao-negativa { color: #ef4444; }
.variacao-neutra { color: var(--text-light); }

.sidebar-list { gap: 0.2rem; }

/* Mobile */
@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

@media (max-width: 640px) {
    .header .container { flex-direction: column; gap: 0.75rem; }
    .header-right { width: 100%; justify-content: space-between; }
    .search-box { flex-direction: column; }
    .news-grid { grid-template-columns: 1fr; }
}
