/* ===================================
   全域樣式
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #06C755;      /* LINE 綠色 */
    --secondary-color: #00B900;
    --danger-color: #E60023;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-light: #F7F9FC;
    --bg-white: #FFFFFF;
    --border-color: #E1E8ED;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Microsoft JhengHei', 'PingFang TC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

/* ===================================
   容器佈局
   =================================== */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
}

/* ===================================
   頁首
   =================================== */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
}

/* ===================================
   表單區域
   =================================== */
#configForm {
    padding: 40px 30px;
}

.form-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h2 {
    font-size: 1.6em;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===================================
   表單群組
   =================================== */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 1em;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.form-group small a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-group small a:hover {
    text-decoration: underline;
}

/* ===================================
   單選按鈕群組
   =================================== */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
}

.radio-label:hover {
    border-color: var(--primary-color);
    background: rgba(6, 199, 85, 0.05);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked + span {
    color: var(--primary-color);
    font-weight: 600;
}

.radio-label span {
    font-size: 1em;
}

/* ===================================
   AI 服務設定區
   =================================== */
.ai-config-section {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

/* ===================================
   滑桿控制
   =================================== */
input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(6, 199, 85, 0.1);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
}

#temp-value {
    display: inline-block;
    min-width: 30px;
    font-weight: 700;
    color: var(--primary-color);
}

/* ===================================
   按鈕樣式
   =================================== */
.form-actions {
    margin-top: 40px;
    text-align: center;
}

.btn-primary,
.btn-secondary,
.btn-outline {
    padding: 16px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.3);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 199, 85, 0.4);
}

.btn-secondary {
    background: #4A90E2;
    color: white;
    margin-right: 10px;
}

.btn-secondary:hover {
    background: #357ABD;
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
}

/* ===================================
   結果顯示區
   =================================== */
.result-section {
    padding: 40px 30px;
    background: var(--bg-light);
}

.result-section h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.code-container {
    margin: 20px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

#generated-code {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    background: #2d2d2d;
    color: #f8f8f2;
    border: none;
    resize: vertical;
}

.result-actions {
    text-align: center;
    margin: 20px 0;
}

/* ===================================
   部署指南
   =================================== */
.deployment-guide {
    margin-top: 30px;
    padding: 25px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.deployment-guide h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.deployment-guide ol {
    padding-left: 25px;
}

.deployment-guide li {
    margin-bottom: 12px;
    line-height: 1.8;
}

.deployment-guide a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.deployment-guide a:hover {
    text-decoration: underline;
}

/* ===================================
   載入動畫
   =================================== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    margin-top: 20px;
    color: white;
    font-size: 1.2em;
}

/* ===================================
   頁尾
   =================================== */
footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 0.9em;
}

footer a {
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
}

footer a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ===================================
   響應式設計
   =================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }

    #configForm,
    .result-section {
        padding: 20px 15px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-outline {
        padding: 12px 30px;
        font-size: 1em;
    }

    .result-actions button {
        display: block;
        width: 100%;
        margin: 10px 0;
    }
}
