/* 基本樣式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.beta-banner-fixed {
    background-color: #fff3cd;
    color: #856404;
    text-align: center;
    padding: 8px;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body {
    font-family: 'Microsoft JhengHei', '微軟正黑體', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    background-image: linear-gradient(135deg, #f5f7fa 0%, #e9f0f8 100%);
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 新增：建議內容和複製按鈕相關樣式 */
.suggestion-item {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.suggestion-item:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.suggestion-item h3 {
    color: #2c3e50;
    font-size: 1.3rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f1f1;
}

.suggestion-number {
    font-size: 0.9rem;
    background-color: #e9f0f8;
    color: #5a6e8c;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 10px;
    vertical-align: middle;
}

.suggestion-section {
    margin-bottom: 20px;
}

.suggestion-section h4 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.suggestion-content {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #4dabf7;
    line-height: 1.5;
    font-size: 1.05rem;
    transition: all 0.2s ease;
}

.suggestion-content:hover {
    background-color: #f1f8ff;
}

.suggestion-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.copy-btn {
    padding: 8px 15px;
    background-color: #e9f0f8;
    color: #2c3e50;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background-color: #d2e3fc;
    color: #1a73e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.copied {
    background-color: #c3e6cb;
    color: #155724;
}

/* 為不同類型的複製按鈕添加特別樣式 */
.copy-all {
    background-color: #d2e3fc;
    color: #1a73e8;
    font-weight: 600;
}

.copy-all:hover {
    background-color: #c2d9fd;
}

.copy-title, .copy-preheader, .copy-suggested-cta {
    background-color: #e9f0f8;
}

.copy-all-tags {
    background-color: #e8f0fe;
    color: #1a73e8;
}

/* 適應手機螢幕 */
@media (max-width: 768px) {
    .suggestion-actions {
        flex-direction: column;
    }
    
    .copy-btn {
        width: 100%;
    }
}

/* 頁首樣式 */
.container > header {
    text-align: center !important;
    margin-bottom: 40px !important;
    padding: 30px 0 !important;
    background-color: hsla(0, 0%, 100%, 0.9) !important;
    color: #555 !important;
    position: relative !important;
    z-index: 1 !important;
    border-radius: 10px !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05) !important;
}

.container > header h1 {
    margin-bottom: 15px !important;
    font-size: 2.2rem !important;
    position: relative !important;
    color: #2c3e50 !important;
    font-weight: 700 !important;
}

.container > header p {
    font-size: 1.1rem !important;
    position: relative !important;
    color: #555 !important;
    margin-bottom: 10px !important;
}

.container > header .marketing-copy {
    max-width: 80% !important;
    margin: 0 auto !important;
    color: #666 !important;
    font-size: 1rem !important;
}

#header-logo {
    height: 45px !important; /* 增加Logo尺寸 */
    width: auto !important;
    margin-bottom: 15px !important;
    display: inline-block !important;
    position: relative !important;
    transition: transform 0.3s ease !important;
}

#header-logo:hover {
    transform: scale(1.05) !important; /* Logo懸停效果 */
}

/* 主要區塊樣式 */
main {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    padding: 30px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

section {
    margin-bottom: 30px;
}

h2 {
    color: #2c3e50;
    margin-bottom: 25px;
    font-size: 1.6rem;
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 12px;
    position: relative;
}

h2:after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background-color: #007bff;
}

.form-group {
    margin-bottom: 25px;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
    font-size: 1.05rem;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    resize: none; /* 移除手動調整大小功能，由自適應取代 */
    font-family: inherit;
    font-size: 1.02rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    min-height: 120px; /* 設置最小高度，相當於約4-5行 */
    max-height: 50vh; /* 設置最大高度，避免過大佔滿螢幕 */
    overflow-y: hidden; /* 隱藏垂直滾動條 */
}

textarea:focus {
    outline: none;
    border-color: #4dabf7;
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.25), inset 0 1px 3px rgba(0,0,0,0.05);
}

/* 表單選項區域 */
.form-options {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.form-options .form-group {
    flex: 1;
    min-width: 250px;
}

.form-select, .form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: #4dabf7;
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.25), inset 0 1px 3px rgba(0,0,0,0.05);
}

.form-input-info {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 8px;
}

.file-upload-container {
    border: 2px dashed #ced4da;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    background-color: #f8f9fa;
}

.file-upload-container:hover {
    border-color: #4dabf7;
    background-color: #f1f8ff;
}

input[type="file"] {
    width: 100%;
    cursor: pointer;
}

.file-upload-info {
    font-size: 0.9rem;
    color: #6c757d;
    margin-top: 12px;
}

.usage-info {
    padding: 12px 15px;
    background-color: #e8f4fd;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #007bff;
    color: #2c3e50;
    font-size: 0.95rem;
}

.btn-primary {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
}

.btn-primary:before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: all 0.5s ease;
}

.btn-primary:hover {
    background-color: #0069d9;
    box-shadow: 0 6px 12px rgba(0, 105, 217, 0.25);
    transform: translateY(-1px);
}

.btn-primary:hover:before {
    left: 100%;
}

.btn-primary:active {
    background-color: #0062cc;
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(0, 98, 204, 0.2);
}

/* 按鈕載入中狀態 */
.btn-primary.loading {
    background-color: #0062cc;
    cursor: wait;
    opacity: 0.85;
}

.btn-primary.loading i {
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 載入動畫和錯誤訊息樣式 */
.loading-container {
    text-align: center;
    padding: 20px;
    margin-top: 15px;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.5s linear infinite;
    margin: 0 auto;
    position: relative;
}

/* 魔法載入動畫效果 */
.loading-spinner.magic-spinner {
    border: 4px solid transparent;
    border-top: 4px solid #007bff;
    border-bottom: 4px solid #9c27b0;
    box-shadow: 0 0 20px rgba(77, 171, 247, 0.6);
    animation: magicSpin 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

.loading-spinner.magic-spinner::before,
.loading-spinner.magic-spinner::after {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid transparent;
    border-radius: 50%;
}

.loading-spinner.magic-spinner::before {
    border-top: 2px solid #4dabf7;
    border-bottom: 2px solid #35bdb2;
    animation: magicSpin 3s ease-in-out infinite reverse;
}

.loading-spinner.magic-spinner::after {
    border-left: 2px solid #ffbb33;
    border-right: 2px solid #ff4081;
    animation: magicSpin 1.5s linear infinite;
}

@keyframes magicSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.loading-container p {
    color: #495057;
    font-size: 1.1rem;
    margin-top: 15px;
}

.error-container {
    padding: 20px;
    background-color: #f8d7da;
    color: #721c24;
    border-radius: 8px;
    margin-top: 25px;
    border-left: 5px solid #dc3545;
    animation: fadeIn 0.5s ease;
}

/* 專門的分析工具樣式 */
.email-tag {
    display: inline-block;
    background-color: #e8f0fe;
    color: #1a73e8;
    padding: 6px 12px;
    margin-right: 10px;
    margin-bottom: 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(26, 115, 232, 0.1);
}

.email-tag:hover {
    background-color: #d2e3fc;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.15);
}

.risk-low { 
    color: #34a853; 
    background-color: rgba(52, 168, 83, 0.1);
}

.risk-medium { 
    color: #fbbc05; 
    background-color: rgba(251, 188, 5, 0.1);
}

.risk-high { 
    color: #ea4335; 
    background-color: rgba(234, 67, 53, 0.1);
}

.risk-indicator {
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 10px;
}

.tone-result {
    margin-bottom: 20px;
    padding: 15px;
    border-left: 4px solid #1a73e8;
    background-color: #f8f9fa;
    border-radius: 0 8px 8px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.tone-category {
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a73e8;
    font-size: 1.05rem;
}

.cta-suggestion {
    background-color: #fff;
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
    border-left: 5px solid #1a73e8;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-suggestion:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.12);
}

.hide-suggestions-count {
    display: none;
}

select:disabled,
input:disabled {
    background-color: #f1f3f4;
    cursor: not-allowed;
    opacity: 0.7;
}

.magic-tagline {
    font-size: 0.75rem;
    color: #007bff;
    background-color: #e8f4fd;
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,123,255,0.15);
    animation: magicGlow 3s infinite alternate;
}

@keyframes magicGlow {
    0% {
        box-shadow: 0 2px 5px rgba(0,123,255,0.15);
    }
    100% {
        box-shadow: 0 2px 12px rgba(0,123,255,0.5);
    }
}

@media (max-width: 768px) {
    .magic-tagline {
        display: block;
        margin: 8px 0 0 0;
        font-size: 0.7rem;
        text-align: center;
        width: fit-content;
    }
}

@media (max-width: 768px) {
    .suggestions-container {
        flex-direction: column;
    }
    .form-control {
        width: 100%;
    }
}

/* 新增的內容高亮效果 */
.highlight-new-content {
    animation: highlightContent 1s ease;
}

@keyframes highlightContent {
    0% { 
        box-shadow: 0 5px 20px rgba(0, 123, 255, 0.1);
    }
    50% { 
        box-shadow: 0 5px 30px rgba(0, 123, 255, 0.4);
    }
    100% { 
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    }
}

.highlight-first-item {
    animation: pulsateItem 1.5s ease;
    position: relative;
}

.highlight-first-item::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: 2px solid #007bff;
    opacity: 0;
    animation: borderPulse 2s ease;
    pointer-events: none;
}

@keyframes pulsateItem {
    0% { 
        transform: translateY(0); 
        background-color: #fff;
    }
    30% { 
        transform: translateY(-5px); 
        background-color: rgba(0, 123, 255, 0.05);
    }
    100% { 
        transform: translateY(0); 
        background-color: #fff;
    }
}

@keyframes borderPulse {
    0% { 
        opacity: 0; 
        transform: scale(0.98);
    }
    50% { 
        opacity: 1; 
        transform: scale(1);
    }
    100% { 
        opacity: 0; 
        transform: scale(1.02);
    }
}

.highlight-title {
    animation: titleHighlight 2s ease;
}

@keyframes titleHighlight {
    0% { 
        color: #2c3e50; 
    }
    50% { 
        color: #007bff; 
    }
    100% { 
        color: #2c3e50; 
    }
}

/* 聚焦元素樣式 */
.suggestion-content:focus,
.tags-list:focus,
.tone-result:focus,
.spam-score:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Utility class to hide elements */
.hidden { display: none !important; }

/* Style for rate limit container */
#rate-limit-container {
    color: #e74c3c;
    margin-top: 10px;
}

/* 頁尾樣式 */
.container > footer {
    margin-top: 30px !important;
    padding-top: 25px !important;
    color: #6c757d !important;
    font-size: 0.95rem !important;
    border-top: 1px solid #e9ecef !important;
    position: relative !important;
    z-index: 1 !important;
}

.container > footer .footer-content {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative !important;
    flex-direction: row !important;
}

.container > footer .footer-left {
    display: flex !important;
    gap: 25px !important;
    position: relative !important;
}

.container > footer .footer-icon {
    color: #6c757d !important;
    font-size: 1.3rem !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    display: inline-block !important;
}

.container > footer .footer-icon:hover {
    color: #007bff !important;
    transform: scale(1.1) !important;
}

.container > footer .footer-right p {
    margin: 0 !important;
    position: relative !important;
}

/* 新增：1Page 推薦橫幅 */
.one-page-banner {
    margin-top: 20px;
    padding: 10px 0;
    text-align: center;
    border-top: 1px solid #eaeaea;
    font-size: 0.9rem;
    color: #666;
    background-color: #f5f7fa;
    border-radius: 0 0 10px 10px;
}

.one-page-banner p {
    margin: 0;
}

.one-page-banner a {
    color: #007bff;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.one-page-banner a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .one-page-banner {
        margin-top: 15px;
        padding: 8px 0;
        font-size: 0.85rem;
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .container > header {
        margin-bottom: 25px !important;
        padding: 20px 0 !important;
    }

    .container > header .marketing-copy {
        max-width: 95% !important;
    }

    .container > footer .footer-content {
        flex-direction: row !important;
    }

    main {
        padding: 20px;
    }

    .btn-primary {
        padding: 12px;
    }

    .result-content {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-btn {
        margin-left: 0;
        margin-top: 12px;
        width: 100%;
    }
    
    .form-options {
        flex-direction: column;
        gap: 15px;
    }

    .container > footer .footer-content {
        flex-direction: column !important;
        gap: 20px !important;
        text-align: center !important;
    }

    .container > footer .footer-left {
        justify-content: center !important;
    }

    .container > header h1 {
        font-size: 1.8rem !important;
    }

    .container > header p {
        font-size: 1rem !important;
    }

    #header-logo {
        height: 35px !important;
    }
    
    .suggestion-content, .result-content p {
        padding: 12px;
    }
}
