body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #e0f2f7; /* Light blue background */
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    display: flex;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 90%;
    max-width: 1200px;
}

.left-panel,
.right-panel {
    padding: 30px;
    flex: 1;
    box-sizing: border-box;
}

.left-panel {
    background-color: #f0f8ff; /* Slightly darker blue for left panel */
    border-right: 1px solid #e0e0e0;
}

.right-panel {
    background-color: #ffffff;
}

h1,
h2 {
    color: #2196f3; /* Blue headings */
    margin-top: 0;
    margin-bottom: 20px;
}

.upload-section,
.preview-section,
.settings-section {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #b3e5fc; /* Light blue border */
    border-radius: 8px;
    background-color: #e3f2fd; /* Very light blue background */
}

.drop-area {
    border: 2px dashed #90caf9; /* Medium blue dashed border */
    border-radius: 8px;
    padding: 15px; /* Reduced padding to make it smaller */
    text-align: center;
    cursor: pointer;
    color: #64b5f6; /* Lighter blue text */
    transition: background-color 0.3s ease;
    margin-bottom: 15px;
}

.drop-area.highlight {
    background-color: #bbdefb; /* Highlight blue */
}

.button {
    background-color: #2196f3; /* Primary blue button */
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
    margin-top: 10px;
    margin-right: 10px;
}

.button:hover {
    background-color: #1976d2; /* Darker blue on hover */
}

.button:disabled {
    background-color: #90caf9; /* Lighter blue when disabled */
    cursor: not-allowed;
}

/* Style for the new task selection dropdown */
#task-select {
    padding: 12px 15px;
    font-size: 16px;
    border-radius: 6px;
    border: 1px solid #b3e5fc;
    background-color: white;
    color: #333;
    cursor: pointer;
    -webkit-appearance: none; /* Removes default browser styling */
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 40px; /* Make space for the arrow */
}

#task-select:hover {
    border-color: #90caf9;
}

input[type="file"] {
    display: none;
}

.image-preview-container {
    width: 100%;
    height: 300px; /* Increased height to enlarge preview area */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-top: 15px;
    margin-bottom: 15px;
    background-color: #f5f5f5;
}

#image-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#no-image-text {
    color: #9e9e9e;
}

.result-box {
    background-color: #e3f2fd; /* Very light blue for result box */
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-y: auto;
    max-height: 400px;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.loading-indicator {
    display: flex;
    align-items: center;
    gap: 10px; /* 間距 */
    font-size: 14px; /* 小型訊息 */
    color: var(--primary-color);
    margin: 0; /* 移除額外邊距 */
}

.spinner {
    width: 20px;
    height: 20px;
    border-width: 3px;
}

.spinner {
    border: 4px solid rgba(33, 150, 243, 0.1);
    border-top: 4px solid #2196f3;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 10px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}

.close-button:hover,
.close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.modal-content label {
    display: block;
    margin-bottom: 8px;
    color: #333;
}

.modal-content input[type="text"] {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

.modal-content .button {
    width: 100%;
    padding: 12px;
    font-size: 18px;
}

/* Add this new class */
.paste-section {
    display: flex;
    align-items: center;
    gap: 10px; /* Space between button and text */
    margin-top: 10px;
}
.paste-section p {
    margin: 0; /* Remove default margin from p */
}

.settings-icon {
    font-size: 24px;
    cursor: pointer;
    color: #2196f3; /* Blue color to match theme */
    transition: color 0.3s ease;
}

.settings-icon:hover {
    color: #1976d2; /* Darker blue on hover */
}

/* Custom Text Icon */
.custom-text-icon {
    font-size: 24px;
    cursor: pointer;
    color: #2196f3;
    transition: color 0.3s ease;
}

.custom-text-icon:hover {
    color: #1976d2;
}

/* Custom Text Modal Textarea */
#custom-text-input {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    resize: vertical; /* Allow vertical resizing */
}

/* Color Schemes */
.theme-blue {
    --primary-color: #2196f3;
    --background-color: #e0f2f7;
    --panel-bg: #f0f8ff;
    --border-color: #b3e5fc;
}

.theme-red {
    --primary-color: #f44336;
    --background-color: #ffebee;
    --panel-bg: #ffcdd2;
    --border-color: #ef9a9a;
}

.theme-yellow {
    --primary-color: #ffeb3b;
    --background-color: #fffde7;
    --panel-bg: #fff9c4;
    --border-color: #fff176;
}

.theme-green {
    --primary-color: #4caf50;
    --background-color: #e8f5e9;
    --panel-bg: #c8e6c9;
    --border-color: #a5d6a7;
}

.theme-gray {
    --primary-color: #9e9e9e;
    --background-color: #f5f5f5;
    --panel-bg: #eeeeee;
    --border-color: #e0e0e0;
}

/* Apply variables */
body {
    background-color: var(--background-color);
}

h1, h2 {
    color: var(--primary-color);
}

.left-panel {
    background-color: var(--panel-bg);
}

.button {
    background-color: var(--primary-color);
}

.button:hover {
    background-color: darken(var(--primary-color), 10%);
}

/* Note: For darken, you might need to adjust manually or use a preprocessor if needed */

.button-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.result-box {
    flex: 1; /* Extend downward */
    min-height: 300px; /* Minimum height to align with preview */
    flex-grow: 1;
    min-height: 400px; /* 增加最小高度以向下延伸，根據需要調整 */
    height: auto; /* 允許自動延伸 */
}

.right-panel {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* 確保右側面板填滿高度 */
}

.container {
    display: flex;
    height: 100%; /* 確保容器填滿可用高度 */
}
.default-url {
    font-size: 12px; /* 細字 */
    color: #666; /* 灰色以示提示 */
    margin-top: 5px;
    margin-bottom: 20px;
    font-style: italic; /* 確保斜體 */
}

@media screen and (max-width: 768px) {
    .container {
        flex-direction: column; /* 垂直堆疊 */
        width: 100%;
        padding: 10px;
    }

    .left-panel,
    .right-panel {
        padding: 15px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .image-preview-container {
        height: 200px; /* 縮小預覽高度 */
    }

    .result-box {
        min-height: 200px;
        max-height: none; /* 移除最大高度限制，讓內容自然延伸 */
        overflow-y: auto; /* 如果內容過長，允許捲動 */
    }

    /* 移除橫屏提示 */
    body::before {
        display: none;
    }

    /* Mobile Camera Modal Styles */
    .modal-content {
        width: 95vw; /* Use viewport width */
        padding: 15px;
    }

    #camera-video {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1; /* Make it a square */
        object-fit: cover; /* Cover the area, might crop a bit */
        border-radius: 8px;
    }

    .camera-buttons {
        flex-direction: column; /* Stack buttons vertically */
        gap: 10px;
        margin-top: 15px;
    }

    .camera-buttons .button {
        width: 100%;
        margin: 0;
    }
    @media screen and (max-width: 768px) {
 
    .button-row {
        flex-wrap: wrap; /* 允許元素換行 */
        justify-content: flex-start; /* 從左對齊 */
        gap: 8px; /* 減小間距以節省空間 */
    }

    .button-row .button,
    .button-row select.button {
        flex: 1 1 auto; /* 讓按鈕和選單靈活調整大小 */
        min-width: 80px; /* 設定最小寬度以避免過小 */
    }

    .button-row span {
        flex: 0 0 auto; /* 圖示不伸縮 */
    }

}
}

@media screen and (orientation: landscape) and (max-width: 768px) {
    #camera-video {
        width: auto;
        height: 100%;
        max-height: 90vh; /* Limit to 90% of viewport height */
        aspect-ratio: 1 / 1; /* Keep square */
        object-fit: cover;
    }

    .modal-content {
        width: auto;
        max-width: 50vw; /* Limit width in landscape */
        padding: 10px;
    }

    .camera-buttons {
        flex-direction: row; /* Horizontal buttons in landscape */
        justify-content: center;
        gap: 20px;
    }
}
.default-url {
    font-size: 12px; /* 細字 */
    color: #666; /* 灰色以示提示 */
    margin-top: 5px;
    margin-bottom: 20px;
}
.camera-buttons {
    display: flex;
    justify-content: space-around;
    margin-top: 10px;
}

/* Desktop Camera Modal Styles */
#camera-video {
    max-width: 100%;
    max-height: 60vh; /* Limit height to 60% of viewport height */
    aspect-ratio: 1 / 1; /* Make it a square */
    object-fit: cover;
    border-radius: 8px;
}

.modal-content {
    width: auto; /* Adjust width automatically */
    max-width: 90vw; /* Limit max width */
}