/* 智能合約風格背景 */
body {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0a0e27 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    color: #e0e0e0;
    position: relative;
    overflow-x: hidden;
}

/* 背景動畫效果 */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 智能合約風格網格背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* 語言切換按鈕 */
.language-toggle {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: 1001;
}

.lang-btn {
    padding: 8px 16px;
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid #00ffff;
    border-radius: 5px;
    color: #00ffff;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* 用戶資訊欄 */
.user-info-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 39, 0.95);
    border-bottom: 2px solid #00ffff;
    padding: 10px 20px;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 255, 255, 0.3);
}

.user-info-content {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.username, .points {
    color: #00ffff;
    font-weight: bold;
}

.history-btn, .logout-btn, .purchase-points-btn {
    padding: 5px 15px;
    background: rgba(0, 255, 255, 0.2);
    border: 1px solid #00ffff;
    color: #00ffff;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Courier New', monospace;
    display: inline-block;
}

.purchase-points-btn {
    padding: 5px 30px; /* 登出按鈕的2倍寬度 */
    font-weight: bold;
}

.history-btn:hover, .logout-btn:hover, .purchase-points-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

/* 容器 */
.container {
    position: relative;
    z-index: 1;
    padding: 100px 20px 20px;
    min-height: 100vh;
}

/* 認證容器 */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.auth-box {
    background: rgba(26, 31, 58, 0.9);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 30px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(0, 255, 255, 0.3);
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: #00ffff;
    border-bottom-color: #00ffff;
}

.tab-btn:hover {
    color: #00ffff;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    color: #00ffff;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #e0e0e0;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    background: rgba(10, 14, 39, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.form-group input.error {
    border-color: #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}

.password-wrapper {
    position: relative;
}

.forgot-password-link {
    position: absolute;
    right: 0;
    bottom: -20px;
    font-size: 12px;
    color: #00ffff;
    text-decoration: none;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.field-hint {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

.error-message {
    display: block;
    color: #ff0000;
    font-size: 12px;
    margin-top: 5px;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    margin-top: 10px;
}

.submit-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.form-actions {
    display: flex;
    gap: 10px;
}

.resend-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 0, 0.2);
    border: 1px solid #ffff00;
    color: #ffff00;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.resend-btn:hover:not(:disabled) {
    background: rgba(255, 255, 0, 0.4);
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
}

.resend-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.info-text {
    text-align: center;
    color: #e0e0e0;
    margin-bottom: 20px;
}

/* 模態框 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(26, 31, 58, 0.95);
    margin: 10% auto;
    padding: 30px;
    border: 2px solid #00ffff;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #00ffff;
}

/* 工具選擇頁面 */
.tool-selection-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.tool-selection-box {
    background: rgba(26, 31, 58, 0.9);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.tool-selection-box h1 {
    color: #00ffff;
    text-align: center;
    margin-bottom: 30px;
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.tool-card {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.tool-card:hover {
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    transform: translateY(-5px);
}

.tool-card h2 {
    color: #00ffff;
    margin-bottom: 15px;
}

.tool-card p {
    color: #e0e0e0;
    margin-bottom: 20px;
}

.tool-btn {
    padding: 12px 30px;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.tool-btn:hover:not(.disabled) {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.tool-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* MLCD 頁面 */
.mlcd-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 120px);
    padding: 20px;
}

.mlcd-box {
    background: rgba(26, 31, 58, 0.9);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 30px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.stage {
    display: none;
}

.stage.active {
    display: block;
}

.stage h2 {
    color: #00ffff;
    margin-bottom: 20px;
}

.warning-box {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.warning-box h3 {
    color: #ffc107;
    margin-top: 0;
}

.warning-box ul {
    color: #e0e0e0;
    margin: 10px 0;
    padding-left: 20px;
}

.warning-box li {
    margin-bottom: 5px;
}

.upload-area {
    border: 2px dashed #00ffff;
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(0, 255, 255, 0.05);
}

.upload-area:hover {
    background: rgba(0, 255, 255, 0.1);
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.status-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}

.status-message.success {
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid #00ff00;
    color: #00ff00;
}

.status-message.error {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid #ff0000;
    color: #ff0000;
}

.files-list {
    margin: 20px 0;
}

.file-item {
    background: rgba(10, 14, 39, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.file-item:hover {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.file-item.selected {
    border-color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
}

.detecting-content {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid rgba(0, 255, 255, 0.3);
    border-top: 4px solid #00ffff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.progress-status {
    margin: 20px auto;
    max-width: 600px;
    padding: 15px 20px;
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

.status-text {
    color: #00ffff;
    font-size: 14px;
    font-weight: bold;
    margin: 0;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    animation: pulse 2s ease-in-out infinite;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: left;
    min-height: 20px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    line-height: 1.5;
}

.status-text::-webkit-scrollbar {
    width: 6px;
}

.status-text::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.status-text::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 255, 0.5);
    border-radius: 3px;
}

.status-text::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 255, 0.7);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.stop-btn {
    padding: 10px 20px;
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid #ff0000;
    color: #ff0000;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 20px;
    transition: all 0.3s;
}

.stop-btn:hover {
    background: rgba(255, 0, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

.result-files {
    margin: 20px 0;
}

.result-file-item {
    background: rgba(10, 14, 39, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-file-item h3 {
    color: #00ffff;
    margin: 0;
}

.result-file-item p {
    color: #e0e0e0;
    margin: 5px 0;
}

.download-btn {
    padding: 10px 20px;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
}

.download-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.back-btn {
    padding: 10px 20px;
    background: rgba(128, 128, 128, 0.2);
    border: 2px solid #808080;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    margin-top: 20px;
}

.back-btn:hover {
    background: rgba(128, 128, 128, 0.4);
    box-shadow: 0 0 10px rgba(128, 128, 128, 0.5);
}

/* 歷史記錄頁面 */
.history-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: calc(100vh - 120px);
    padding: 20px;
}

.history-box {
    background: rgba(26, 31, 58, 0.9);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 30px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.3);
}

.history-box h1 {
    color: #00ffff;
    margin-bottom: 20px;
}

.history-list {
    margin-top: 20px;
}

.history-item {
    background: rgba(10, 14, 39, 0.8);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item h3 {
    color: #00ffff;
    margin: 0;
}

.history-item p {
    color: #e0e0e0;
    margin: 5px 0;
}

/* 點數購買頁面 */
.purchase-points-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 120px);
}

.purchase-points-box {
    background: rgba(26, 31, 58, 0.9);
    border: 2px solid #00ffff;
    border-radius: 10px;
    padding: 40px;
    width: 100%;
    max-width: 1000px;
}

.purchase-points-box h1 {
    color: #00ffff;
    text-align: center;
    margin-bottom: 30px;
}

.points-plans {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.plan-card {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.plan-card:hover {
    border-color: #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
    transform: translateY(-5px);
}

.plan-card h2 {
    color: #00ffff;
    font-size: 28px;
    margin-bottom: 15px;
}

.plan-price {
    color: #e0e0e0;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 20px;
}

.plan-btn {
    padding: 12px 30px;
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid #00ffff;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 16px;
    width: 100%;
}

.plan-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: rgba(26, 31, 58, 0.95);
    margin: 10% auto;
    padding: 30px;
    border: 2px solid #00ffff;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    position: relative;
}

.modal-content h2 {
    color: #00ffff;
    margin-bottom: 20px;
}

.modal-content p {
    color: #e0e0e0;
    margin: 10px 0;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border: 2px solid;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    font-size: 14px;
}

.confirm-btn {
    background: rgba(0, 255, 255, 0.2);
    border-color: #00ffff;
    color: #00ffff;
}

.confirm-btn:hover {
    background: rgba(0, 255, 255, 0.4);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.cancel-btn {
    background: rgba(128, 128, 128, 0.2);
    border-color: #808080;
    color: #e0e0e0;
}

.cancel-btn:hover {
    background: rgba(128, 128, 128, 0.4);
    box-shadow: 0 0 15px rgba(128, 128, 128, 0.5);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .points-plans {
        grid-template-columns: 1fr;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
    }
    
    .user-info-content {
        flex-wrap: wrap;
        gap: 10px;
    }
}
