/* stock-dividend-tracker/assets/css/style.css */

/* 全域設定 */
body {
    background-color: #f8f9fa;
    color: #333;
}

/* 頁面容器 */
.container {
    max-width: 1200px;
}

/* 卡片樣式 */
.card {
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: #f1f8ff;
    border-bottom: 1px solid #dce6f0;
    font-weight: bold;
}

/* 股票卡片樣式 */
.stock-card {
    cursor: pointer;
}

.stock-card .card-body {
    padding: 1.25rem;
}

.stock-card .stock-code {
    font-size: 0.85rem;
    color: #6c757d;
}

.stock-card .stock-name {
    font-size: 1.2rem;
    font-weight: bold;
}

.stock-card .stock-price {
    font-size: 1.1rem;
}

.stock-card .stock-value {
    font-size: 1.3rem;
    font-weight: bold;
}

/* 損益顯示樣式 */
.profit {
    color: #dc3545; /* 紅色表示盈利 */
    font-weight: bold;
}

.loss {
    color: #198754; /* 綠色表示虧損 */
    font-weight: bold;
}

/* 表格樣式 */
.table-responsive {
    overflow-x: auto;
}

.table th {
    background-color: #f1f8ff;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* 表單控制元件 */
.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* 按鈕樣式 */
.btn {
    border-radius: 5px;
    padding: 0.375rem 0.75rem;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-success {
    background-color: #198754;
    border-color: #198754;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
}

/* 股利月份選擇 */
.month-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.month-checkbox-label {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    background-color: #fff;
    transition: background-color 0.2s, border-color 0.2s;
}

.month-checkbox-label:hover {
    background-color: #e9ecef;
}

.month-checkbox-label.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.month-checkbox {
    margin-right: 5px;
}

/* 響應式調整 */
@media (max-width: 767.98px) {
    .card-deck {
        flex-direction: column;
    }
    
    .stock-card {
        width: 100%;
        margin-bottom: 15px;
    }
    
    .month-checkbox-group {
        justify-content: flex-start;
    }
    
    .month-checkbox-label {
        margin-right: 0;
        flex-basis: calc(25% - 8px);
    }
}

/* 小螢幕裝置 */
@media (max-width: 575.98px) {
    .month-checkbox-label {
        flex-basis: calc(33.33% - 8px);
    }
    
    .table thead {
        display: none;
    }
    
    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }
    
    .table tr {
        margin-bottom: 15px;
        border-bottom: 2px solid #dee2e6;
    }
    
    .table td {
        position: relative;
        padding-left: 50%;
        text-align: right;
        border-bottom: 1px solid #dee2e6;
    }
    
    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 15px;
        font-weight: bold;
        text-align: left;
    }
}

/* 預計股利發放顯示 */
.dividend-month-card {
    margin-bottom: 15px;
}

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

.dividend-month-card .month-total {
    font-size: 1.2rem;
    font-weight: bold;
}

/* 股利發放作業 */
.dividend-process-item {
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

.dividend-process-item:last-child {
    border-bottom: none;
}

/* 警告和提示 */
.alert {
    border-radius: 8px;
    margin-bottom: 20px;
}

/* 加載動畫 */
.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 0.2rem solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0d6efd;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
