:root {
    --primary-color: #4a90e2;
    --secondary-color: #50e3c2;
    --background-color: #f7f9fc;
    --card-background: #ffffff;
    --text-color: #333;
    --muted-text-color: #666;
    --border-color: #e0e5eb;
    --input-border-color: #ced4da;
    --success-color: #28a745;
    --error-color: #dc3545;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --border-radius: 6px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    padding: 30px;
    max-width: 900px;
    margin: 40px auto;
    background-color: var(--background-color);
    color: var(--text-color);
}
.container {
    background-color: var(--card-background);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}
h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 40px;
    font-weight: 600;
    font-size: 2em;
}
h3 {
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 30px;
    margin-bottom: 20px;
    font-weight: 600;
}
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95em;
}
small, .tooltip-text {
    color: var(--muted-text-color);
    font-size: 0.85em;
    display: block;
    margin-bottom: 15px;
    line-height: 1.4;
}
input[type="file"] {
    display: block;
    margin-bottom: 5px; /* Reduced margin */
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border-color);
    border-radius: var(--border-radius);
    background-color: #fff;
    transition: border-color 0.2s ease;
}
input[type="file"]:hover {
    border-color: var(--primary-color);
}

button {
    display: inline-block; /* Changed for flexibility */
    width: auto; /* Changed for flexibility */
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    margin-bottom: 15px;
}
button:hover:not(:disabled) {
    background-color: var(--secondary-color); /* Slightly darker primary */
    transform: translateY(-1px);
}
button:active:not(:disabled) {
    transform: translateY(0px);
}
button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
}

#createButton, #processBatchBtn {
    width: 100%;
    padding: 14px;
    font-size: 1.1em;
    margin-top: 10px;
}

#status {
    margin-top: 25px;
    padding: 15px;
    border-radius: var(--border-radius);
    background-color: #e9ecef;
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 250px;
    overflow-y: auto;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: var(--muted-text-color);
    line-height: 1.5;
}

#downloadLink, .batch-download-link {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background-color: var(--success-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
    transition: background-color 0.3s ease;
}
#downloadLink:hover, .batch-download-link:hover {
    background-color: #218838;
}

.loader {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tabs styling */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}
.tab-btn {
    padding: 12px 25px;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    margin-right: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--muted-text-color);
    transition: color 0.3s ease, border-color 0.3s ease;
    margin-bottom: -1px; /* Align with bottom border */
}
.tab-btn:hover {
    color: var(--primary-color);
}
.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}
.tab-content {
    display: none;
    padding: 10px 0;
}
.tab-content.active {
    display: block;
}

/* Input groups */
.input-group {
    margin-bottom: 25px;
}

/* Preview area */
.preview-container {
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--border-radius);
    background-color: #f8f9fa;
}
#previewArea {
    margin-bottom: 15px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eee;
    border-radius: var(--border-radius);
    overflow: hidden;
}
#previewArea img, #previewArea video {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
}
.preview-placeholder {
    color: var(--muted-text-color);
    text-align: center;
    padding: 50px 20px;
}
#generatePreviewBtn {
    display: block;
    margin: 10px auto 0 auto;
    background-color: var(--secondary-color);
}
#generatePreviewBtn:hover:not(:disabled) {
    background-color: #45c9b0;
}

/* Progress bar */
#progress-container {
    margin: 25px 0;
}
#progress-bar {
    width: 100%;
    height: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}
#progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
    border-radius: 5px;
}
#progress-text {
    text-align: right;
    font-size: 0.9em;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 5px;
}
#estimated-time {
    text-align: right;
    font-size: 0.85em;
    color: var(--muted-text-color);
    font-style: italic;
}

/* Settings */
.settings-group {
    margin-bottom: 20px;
    position: relative; /* For tooltips */
}
.settings-group label {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
}
.settings-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border-color);
    border-radius: var(--border-radius);
    background-color: #fff;
    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%23666666%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: 10px 10px;
    cursor: pointer;
}
#saveSettingsBtn {
    margin-top: 15px;
}
#settingsSavedMsg {
    color: var(--success-color);
    margin-top: 15px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.5s ease;
}
#settingsSavedMsg:not(.hidden) {
    opacity: 1;
}
.hidden {
    display: none;
}

/* Batch processing */
.batch-container {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color);
}
.batch-item {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.batch-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}
.batch-item-header span {
    font-weight: 600;
    color: var(--text-color);
}
.remove-batch-item {
    background-color: transparent;
    color: var(--error-color);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    transition: background-color 0.2s ease;
}
.remove-batch-item:hover {
    background-color: rgba(220, 53, 69, 0.1);
}
.batch-item-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}
.batch-item-inputs input {
    margin-bottom: 0;
}
.batch-item-status {
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-size: 0.9em;
    text-align: center;
    font-weight: 500;
    margin-top: 10px;
    background-color: #e9ecef;
    color: var(--muted-text-color);
}
.batch-item-status.success {
    background-color: #d4edda;
    color: #155724;
}
.batch-item-status.error {
    background-color: #f8d7da;
    color: #721c24;
}
.batch-item-status.processing {
    background-color: #cce5ff;
    color: #004085;
}
.batch-item-status.skipped {
    background-color: #fff3cd;
    color: #856404;
}
#addBatchItemBtn {
    background-color: var(--info-color);
    margin-bottom: 20px;
}
#addBatchItemBtn:hover:not(:disabled) {
    background-color: #138496;
}
#batchStatus {
    margin: 20px 0;
    padding: 12px;
    background-color: #e9ecef;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
}
#batchResults {
    margin-top: 20px;
}
.batch-download {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.batch-download span {
    font-size: 0.95em;
    color: var(--text-color);
    flex-grow: 1;
    margin-right: 15px;
    word-break: break-all;
}

/* Tooltip icon */
.tooltip-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: var(--muted-text-color);
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 11px;
    line-height: 16px;
    cursor: help;
    margin-left: 8px;
    position: relative; /* Needed for potential future popover tooltips */
}


/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        padding: 20px 15px;
        margin: 20px auto;
    }
    .container {
        padding: 25px;
    }
    h1 {
        font-size: 1.8em;
    }
    .tabs {
        margin-bottom: 20px;
    }
    .tab-btn {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    .batch-item-inputs {
        grid-template-columns: 1fr; /* Stack inputs on smaller screens */
    }
    .batch-download {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .batch-download span {
        margin-right: 0;
        margin-bottom: 5px;
    }
    #downloadLink {
        display: block; /* Make download link full width on mobile */
        width: 100%;
    }
} 