/* ===================================================================
   露營用電計算器 - 專屬樣式
   Camping Power Calculator - Calculator-Specific Styles

   ⚠️ IMPORTANT: DO NOT redefine global classes!
   - .form-input, .btn-custom, .glass-card, etc. are in layout.css
   - Only define calculator-specific styles here
   =================================================================== */

/* 設備清單項目 */
.device-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.device-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateX(5px);
}

.device-info {
    flex: 1;
}

.device-name {
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.device-details {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    color: #666;
}

.device-power {
    font-family: 'Roboto Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: #48bb78;
    margin: 0 15px;
}

.device-actions {
    display: flex;
    gap: 8px;
}

.btn-edit-device, .btn-delete-device {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit-device {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.btn-edit-device:hover {
    background: #667eea;
    color: white;
}

.btn-delete-device {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-delete-device:hover {
    background: #ef4444;
    color: white;
}

/* 新增設備按鈕 */
.btn-add-device {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-add-device:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

/* 設備類型標籤 */
.device-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

.device-type-continuous {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.device-type-charging {
    background: rgba(72, 187, 120, 0.15);
    color: #48bb78;
}

/* 計算結果顯示 */
.result-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.result-item {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.result-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.result-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
}

.result-unit {
    font-size: 1.2rem;
    margin-left: 5px;
}

/* 智能建議卡片 */
.suggestion-card {
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: start;
    gap: 12px;
}

.suggestion-card.success {
    background: rgba(72, 187, 120, 0.1);
    border-left: 4px solid #48bb78;
}

.suggestion-card.warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid #f59e0b;
}

.suggestion-card.error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
}

.suggestion-icon {
    font-size: 1.5rem;
}

.suggestion-content {
    flex: 1;
}

.suggestion-title {
    font-weight: 600;
    margin-bottom: 5px;
}

/* 情境快選按鈕 */
.scenario-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.btn-scenario {
    padding: 10px 15px;
    background: white;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    color: #667eea;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-scenario:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: #667eea;
}

.btn-scenario.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* 圖表容器 */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

/* 詳細計算步驟 */
.calculation-steps {
    background: rgba(102, 126, 234, 0.05);
    padding: 20px;
    border-radius: 12px;
    margin-top: 15px;
}

.calculation-steps h4 {
    font-family: 'Poppins', sans-serif;
    color: #667eea;
    margin-bottom: 15px;
}

.calculation-step {
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.9rem;
}

.calculation-step .formula {
    color: #667eea;
    font-weight: 600;
}

/* 行動電源選擇器 */
.powerbank-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.powerbank-option {
    padding: 15px;
    background: white;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.powerbank-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.powerbank-option.selected {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-color: #667eea;
    border-width: 3px;
}

.powerbank-name {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 5px;
}

.powerbank-specs {
    font-size: 0.85rem;
    color: #666;
}

/* 空狀態提示 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 3rem;
    color: rgba(102, 126, 234, 0.3);
    margin-bottom: 15px;
}

.empty-state p {
    font-size: 1.1rem;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .device-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .device-power {
        margin: 10px 0;
    }

    .device-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .scenario-buttons {
        grid-template-columns: 1fr;
    }

    .powerbank-selector {
        grid-template-columns: 1fr;
    }

    .chart-container {
        height: 250px;
    }
}

/* KaTeX 公式樣式優化 */
.katex-display {
    margin: 15px 0;
    overflow-x: auto;
    overflow-y: hidden;
}

.katex {
    font-size: 1.1em;
}

/* ===================================================================
   模態框樣式 (Modal Dialogs)
   =================================================================== */

/* 模態框覆蓋層 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 模態框對話框 */
.modal-dialog {
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 模態框內容 */
.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 模態框標題 */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
}

.btn-close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 模態框主體 */
.modal-body {
    padding: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
}

/* 預覽框 */
.preview-box {
    background: rgba(102, 126, 234, 0.08);
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.preview-box strong {
    color: #667eea;
    display: block;
    margin-bottom: 8px;
}

.preview-box div {
    font-family: 'Roboto Mono', monospace;
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

/* 模態框底部 */
.modal-footer {
    padding: 20px;
    background: #f9f9f9;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-footer .btn {
    min-width: 100px;
}

/* 響應式設計 - 模態框 */
@media (max-width: 576px) {
    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 15px;
    }

    .modal-header h3 {
        font-size: 1.1rem;
    }

    .modal-body {
        padding: 20px 15px;
    }

    .modal-footer {
        padding: 15px;
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}
