/**
 * pokemon-cal.css
 * 寶可夢素質計算器的樣式表
 */

/* 頁面標題區 */
.page-header {
    padding-bottom: 1.5rem;
}

.page-header h2 {
    color: #0066cc;
    font-weight: 700;
}

.page-header .text-muted {
    font-size: 0.95rem;
}

/* 卡片樣式 */
.card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1rem;
}

.card-header h5 {
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}

.card-body {
    padding: 1rem;
}

/* 表單標籤樣式 */
.form-label {
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
}

/* IV 選擇組 */
.stat-select-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-select-item {
    display: flex;
    flex-direction: column;
}

.stat-select-item .form-label {
    font-size: 0.85rem;
}

.stat-select-item .form-select-sm {
    font-size: 0.8rem;
}

/* EV 輸入組 */
.stat-input-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-input-item {
    display: flex;
    flex-direction: column;
}

.stat-input-item .form-label {
    font-size: 0.85rem;
}

.stat-input-item .form-control-sm {
    font-size: 0.85rem;
}

/* 按鈕樣式 */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #0066cc;
    border-color: #0066cc;
}

.btn-primary:hover {
    background-color: #0052a3;
    border-color: #0052a3;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #218838;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* 結果顯示 */
.result-stats-table {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.stat-result-item {
    text-align: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.stat-result-label {
    font-weight: 600;
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.stat-result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0066cc;
}

.stat-result-value.increased {
    color: #dc3545;
}

.stat-result-value.decreased {
    color: #0066cc;
}

.stat-arrow {
    font-size: 0.8rem;
    margin-left: 0.25rem;
    font-weight: bold;
}

/* 傷害計算結果表格 */
.damage-result-table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.damage-result-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    vertical-align: middle;
}

.damage-result-table td {
    vertical-align: middle;
}

.damage-result-table .type-badge {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* 響應式表格調整 */
@media (max-width: 992px) {
    .damage-result-table {
        font-size: 0.85rem;
    }
    
    .damage-result-table th, 
    .damage-result-table td {
        padding: 0.5rem;
    }
}

/* 能力值顯示卡片 */
.stats-card {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.stats-card-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-card-row:last-child {
    margin-bottom: 0;
}

.stat-display-item {
    text-align: center;
}

.stat-display-label {
    font-weight: 600;
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-display-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0066cc;
}

/* 空狀態提示 */
.text-muted {
    color: #6c757d;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .stat-select-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-input-group {
        grid-template-columns: repeat(2, 1fr);
    }

    .result-stats-table {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-card-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .card {
        margin-bottom: 1rem;
    }

    .btn-lg {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .stat-select-group {
        grid-template-columns: 1fr;
    }

    .stat-input-group {
        grid-template-columns: 1fr;
    }

    .result-stats-table {
        grid-template-columns: 1fr;
    }

    .stats-card-row {
        grid-template-columns: 1fr;
    }

    .stat-result-value {
        font-size: 1.25rem;
    }

    .damage-value {
        font-size: 1rem;
    }
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-stats-table .stat-result-item {
    animation: fadeIn 0.3s ease;
}

.result-damage-card {
    animation: fadeIn 0.3s ease;
}

/* 加載狀態 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-small {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* 錯誤訊息 */
.alert-danger {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* 成功訊息 */
.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

/* 調整網格間距 */
.row.g-3 {
    margin-bottom: 1.5rem;
}

.row.g-3:last-child {
    margin-bottom: 0;
}

/* 自訂下拉選單樣式 */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    margin-bottom: 1rem;
}

.custom-select-btn {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    padding-right: 2rem;
    background-color: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
}

.custom-select-btn:hover {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.1);
}

.custom-select-btn:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
    outline: none;
}

.custom-select-btn::after {
    content: '▼';
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.7rem;
    color: #666;
}

.custom-select-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-height: 300px;
    overflow-y: auto;
    z-index: 10000;
    margin-top: 0.25rem;
}

.custom-select-options {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.custom-select-option {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    z-index: 10001;
}

.custom-select-option:last-child {
    border-bottom: none;
}

.custom-select-option:hover {
    background-color: #f8f9fa;
}

.custom-select-option.selected {
    background-color: #e7f3ff;
}

.custom-select-option-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.custom-select-option-badges {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* 傷害計算頁面：警示/說明樣式 */
#section2-note {
    display: block;
    background-color: #fff8e1; /* 淡黃色背景 */
    border: 1px solid #ffe0b2;
    border-left: 4px solid #ffc107; /* 左側醒目條 */
    color: #6b4f00;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-style: italic;
}

#section2-note::before {
    content: "⚠";
    display: inline-block;
    margin-right: 0.5rem;
    color: #d97706; /* 橙色警示 */
    font-weight: 700;
}

@media (max-width: 576px) {
    #section2-note { font-size: 0.9rem; }
}
