/* finance.sing129.com 財務分析 Web */

:root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-elevated: #21262d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #2ea043;
    --accent-hover: #3fb950;
    --accent-muted: #238636;
    --border: #30363d;
    --score-high: #2ea043;
    --score-mid: #d4a72c;
    --score-low: #da3633;
    --market-us: #1f6feb;
    --market-hk: #a371f7;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Noto Sans TC", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.logo {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo:hover {
    color: var(--accent);
}

.site-header nav a {
    margin-left: 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
}

.site-header nav a:hover {
    color: var(--accent);
}

.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
}

h1 {
    font-size: 1.75rem;
    margin-top: 0;
}

/* Home hero - full page main section */
.home-hero {
    text-align: center;
    padding: 3rem 2rem 4rem;
    margin: 0 -1.25rem 2rem;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}
.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 0.5rem;
}
.hero-tagline {
    font-size: 1.1rem;
    color: var(--accent);
    margin: 0 0 0.5rem;
    font-weight: 500;
}
.hero-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 420px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}
.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}
.hero-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    text-decoration: none;
    font-weight: 500;
}
.hero-btn-primary {
    background: var(--accent);
    color: #fff;
}
.hero-btn-primary:hover {
    background: var(--accent-hover);
    color: #fff;
}
.hero-btn-secondary {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}
.hero-btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Section titles */
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* Updates section */
.updates-section {
    margin-bottom: 2.5rem;
}
.updates-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.update-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.update-item:last-child {
    border-bottom: none;
}
.update-date {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    width: 5rem;
}
.update-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.update-title {
    font-size: 0.95rem;
}
.update-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
}

/* Reports section */
.reports-section {
    margin-bottom: 2rem;
}
#reports {
    scroll-margin-top: 4rem;
}

/* Filter form */
.filter-form {
    margin-bottom: 1rem;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.filter-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.filter-main {
    gap: 1rem;
}
.filter-criteria {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}
.search-wrap {
    flex: 1;
    min-width: 160px;
}
.search-input {
    width: 100%;
    min-width: 160px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}
.search-input::placeholder {
    color: var(--text-muted);
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
}
.market-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    min-width: 100px;
}
.filter-actions {
    display: flex;
    gap: 0.5rem;
}
.filter-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.num-input {
    width: 64px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
}
.btn-primary, .compare-form button {
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-primary:hover, .compare-form button:hover {
    background: var(--accent-hover);
}
.btn-secondary {
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 6px;
}
.btn-secondary:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

/* Quick filters */
.quick-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.quick-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.quick-chip {
    padding: 0.3rem 0.6rem;
    background: var(--bg-elevated);
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    border: 1px solid var(--border);
}
.quick-chip:hover {
    color: var(--accent);
    border-color: var(--accent-muted);
}

/* Table header */
.table-header {
    margin-bottom: 0.5rem;
}
.result-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Table wrap for horizontal scroll on mobile */
.table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.data-table, .compare-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table th, .data-table td,
.compare-table th, .compare-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th, .compare-table th {
    background: rgba(88, 166, 255, 0.1);
    font-weight: 600;
}

.data-table th a, .compare-table th a {
    color: var(--accent);
    text-decoration: none;
}

.data-table th a:hover, .compare-table th a:hover {
    text-decoration: underline;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table td a, .compare-table td a {
    color: var(--accent);
    text-decoration: none;
}

.ticker-cell {
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 0.95rem;
}

.market-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}
.market-us {
    background: rgba(31, 111, 235, 0.2);
    color: #58a6ff;
}
.market-hk {
    background: rgba(163, 113, 247, 0.2);
    color: #a371f7;
}

.score-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}
.score-high {
    background: rgba(46, 160, 67, 0.2);
    color: var(--score-high);
}
.score-mid {
    background: rgba(212, 167, 44, 0.2);
    color: var(--score-mid);
}
.score-low {
    background: rgba(218, 54, 51, 0.2);
    color: var(--score-low);
}

.actions-cell {
    white-space: nowrap;
}
.action-link {
    margin-right: 0.5rem;
}
.action-link:last-child {
    margin-right: 0;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

.compare-link {
    margin-left: 0.5rem;
}

@media (max-width: 768px) {
    .filter-main {
        flex-direction: column;
        align-items: stretch;
    }
    .search-wrap {
        min-width: 100%;
    }
    .quick-filters {
        flex-direction: column;
        align-items: flex-start;
    }
}

.detail-header {
    margin-bottom: 1rem;
}

.detail-header .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.external-links {
    margin-top: 0.5rem;
}
.external-links a {
    margin-right: 1rem;
    color: var(--accent);
    font-size: 0.9rem;
}
.external-links a:hover {
    text-decoration: underline;
}

.metrics-card {
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.metrics-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem 1.5rem;
}
.metric-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.metric-label {
    color: var(--text-muted);
    font-size: 0.8rem;
}
.metric-value {
    font-weight: 500;
    font-size: 1rem;
}

.chart-block {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.chart-img {
    max-width: 100%;
    height: auto;
}

.report-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.report-content th, .report-content td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
}

.report-content h2, .report-content h3 {
    margin-top: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.back-link {
    margin-top: 2rem;
}

.back-link a {
    color: var(--accent);
    text-decoration: none;
}

.compare-form {
    margin-bottom: 1.5rem;
}

.tickers-input {
    min-width: 280px;
    padding: 0.5rem;
    margin-right: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
}

.site-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}
