/* Base64 編解碼器特定樣式 */

/* 模式標籤 */
.mode-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.tab-button {
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: var(--text-color);
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.tab-button:hover {
    background: var(--light-gray);
    border-radius: 8px 8px 0 0;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--card-bg);
}

/* 模式內容 */
.mode-content {
    animation: fadeIn 0.3s ease;
}

.mode-content.hidden {
    display: none;
}

/* Base64 容器 */
.base64-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: start;
}

.input-panel, .output-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-panel h3, .output-panel h3 {
    color: var(--secondary-color);
    margin: 0;
    font-size: 1.1rem;
}

/* Base64 文字區域 */
.base64-textarea {
    width: 100%;
    min-height: 300px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.3s ease;
    background: var(--card-bg);
    color: var(--text-color);
}

.base64-textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.1);
}

/* 資訊顯示 */
.input-info, .output-info {
    display: flex;
    gap: 2rem;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.8;
}

.input-info span, .output-info span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* 動作按鈕 */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    min-width: 100px;
}

.action-buttons .btn {
    white-space: nowrap;
    padding: 0.8rem 1.2rem;
}

.tool-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* 檔案上傳區域 */
.file-upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 15px;
    padding: 3rem;
    text-align: center;
    background: var(--light-gray);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
}

.file-upload-area.drag-over {
    border-color: var(--secondary-color);
    background: rgba(98, 126, 234, 0.1);
    transform: scale(1.02);
}

.file-upload-content {
    pointer-events: none;
}

.file-upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.file-upload-area h3 {
    color: var(--text-color);
    margin: 0 0 0.5rem 0;
}

.file-upload-area p {
    color: var(--text-color);
    opacity: 0.7;
    margin: 0 0 1.5rem 0;
}

.hidden {
    display: none !important;
}

/* 檔案資訊 */
.file-info {
    background: var(--light-gray);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.file-info h3 {
    color: var(--secondary-color);
    margin: 0 0 1rem 0;
}

.file-details {
    display: grid;
    gap: 0.5rem;
}

.file-details p {
    margin: 0;
    display: flex;
    gap: 0.5rem;
}

.file-details p span {
    font-weight: 500;
    color: var(--primary-color);
}

/* 檔案預覽 */
.file-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 8px;
    text-align: center;
}

.file-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.file-preview p {
    margin: 0;
    color: var(--text-color);
    opacity: 0.7;
}

/* 檔案結果 */
.file-result {
    margin-top: 2rem;
}

.file-result h3 {
    color: var(--secondary-color);
    margin: 0 0 1rem 0;
}

/* 訊息提示 */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 350px;
    font-weight: 500;
}

.message-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.message-toast.success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.message-toast.error {
    background: linear-gradient(135deg, #dc3545, #f86734);
    color: white;
}

.message-toast.warning {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: white;
}

.message-toast.info {
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
}

/* 深色模式支援 */
[data-theme="dark"] .base64-textarea {
    background: #2a2a2a;
    color: #ffffff;
    border-color: #404040;
}

[data-theme="dark"] .base64-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(247, 147, 26, 0.2);
}

[data-theme="dark"] .file-upload-area {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .file-upload-area:hover {
    background: #333333;
    border-color: var(--primary-color);
}

[data-theme="dark"] .file-info {
    background: #2a2a2a;
}

[data-theme="dark"] .file-preview {
    background: #1e1e1e;
}

[data-theme="dark"] .tab-button:hover {
    background: #333333;
}

[data-theme="dark"] .tab-button.active {
    background: var(--card-bg);
}

/* 響應式設計 */
@media (max-width: 1024px) {
    .base64-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .action-buttons {
        flex-direction: row;
        justify-content: center;
        width: 100%;
    }
    
    .base64-textarea {
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .mode-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        flex-shrink: 0;
    }
    
    .file-upload-area {
        padding: 2rem 1rem;
    }
    
    .file-upload-icon {
        font-size: 3rem;
    }
    
    .tool-actions {
        flex-direction: column;
    }
    
    .tool-actions .btn {
        width: 100%;
    }
    
    .message-toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .base64-textarea {
        min-height: 150px;
        font-size: 0.85rem;
    }
    
    .input-info, .output-info {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .file-details {
        font-size: 0.9rem;
    }
}

/* 動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 載入動畫 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* 範例區塊 */
.example-section {
    background: var(--light-gray);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-section p {
    margin: 0 0 1rem 0;
    color: var(--text-color);
}

.example-section ul {
    margin: 0 0 1.5rem 0;
    padding-left: 1.5rem;
}

.example-section li {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.example-section code {
    background: var(--card-bg);
    padding: 3px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: var(--primary-color);
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

.example-section .btn {
    margin-top: 0.5rem;
}

/* 範例標籤 */
.example-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.example-tab {
    padding: 0.5rem 1rem;
    background: var(--border-color);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-tab:hover {
    background: var(--primary-color);
    color: white;
}

.example-tab.active {
    background: var(--primary-color);
    color: white;
}

.example-content {
    animation: fadeIn 0.3s ease;
}

/* 安全提醒 */
.security-notice {
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border-left: 4px solid #28a745;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.security-notice h4 {
    color: #155724;
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.security-notice ul {
    margin: 0;
    padding-left: 1.5rem;
}

.security-notice li {
    margin-bottom: 0.5rem;
    color: #155724;
}

/* 深色模式支援 */
[data-theme="dark"] .example-section {
    background: #2a2a2a;
}

[data-theme="dark"] .example-section code {
    background: #1e1e1e;
    border-color: #404040;
}

[data-theme="dark"] .example-tab {
    background: #404040;
    color: #ffffff;
}

[data-theme="dark"] .example-tab:hover,
[data-theme="dark"] .example-tab.active {
    background: var(--primary-color);
}

[data-theme="dark"] .security-notice {
    background: linear-gradient(135deg, #1a2f1a, #2a3e2a);
    border-left-color: #4ade80;
}

[data-theme="dark"] .security-notice h4,
[data-theme="dark"] .security-notice li {
    color: #86efac;
}