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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 800px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
}

.bottom-logo {
    width: 100%;
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.logo-img {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.header-image {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.subtitle {
    color: #666;
    font-size: 1.3rem;
    font-weight: 500;
}

.subtitle a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 600;
}

.subtitle a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.search-section {
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#stockInput {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
}

#stockInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.search-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.search-btn:active:not(:disabled) {
    transform: translateY(0);
}

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.result-section {
    margin-top: 30px;
    animation: slideUp 0.3s ease-out;
}

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

.result-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #e0e0e0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.result-header h2 {
    color: #333;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #e0e0e0;
    color: #333;
}

.chart-container {
    width: 100%;
    height: calc(100vh - 300px);
    min-height: 600px;
    margin: 20px 0;
    padding: 20px;
    background: #2d2d2d; /* 深灰色背景 */
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.chart-container canvas {
    flex: 1;
    width: 100% !important;
    height: 100% !important;
}

.data-info {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.data-tips {
    margin-bottom: 20px;
    text-align: center;
}

.tip-text {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    word-wrap: break-word;
    word-break: break-all;
}

.data-summary h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.data-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

.data-label {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.data-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: #333;
}

.data-count {
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
    text-align: center;
}

.result-content {
    color: #333;
    line-height: 1.8;
    font-size: 1rem;
}

.result-content h1 {
    color: #333;
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
    font-weight: 700;
}

.result-content h2 {
    color: #667eea;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.result-content h3 {
    color: #667eea;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.result-content p {
    margin-bottom: 15px;
    text-align: justify;
}

.result-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
    padding-left: 20px;
}

.result-content li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.result-content strong {
    color: #333;
    font-weight: 600;
}

/* 研究報告表格樣式 */
.result-content .report-table,
.result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-content .report-table td,
.result-content table td {
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.result-content .report-table tr:first-child td,
.result-content table tr:first-child td {
    background: #667eea;
    color: white;
    font-weight: 600;
    border-color: #5568d3;
}

.result-content .report-table tr:nth-child(even) td,
.result-content table tr:nth-child(even) td {
    background: #f8f9fa;
}

/* 評價標籤樣式 */
.result-content .rating-buy {
    color: #28a745;
    font-weight: 700;
}

.result-content .rating-strong-buy {
    color: #155724;
    font-weight: 700;
}

.result-content .rating-neutral {
    color: #ffc107;
    font-weight: 700;
}

.result-content .rating-sell {
    color: #dc3545;
    font-weight: 700;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid #c33;
    margin-top: 20px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
    }
}

