:root {
    --primary-color: #4361ee;
    --secondary-color: #3a0ca3;
    --accent-color: #f72585;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --success-color: #4cc9f0;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

.container {
    width: 100%;
    max-width: 1000px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    position: relative;
    display: inline-block;
    font-weight: 800;
    letter-spacing: -1px;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.tagline {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin: 1.5rem 0;
    font-weight: 500;
    opacity: 0.9;
}

p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.upload-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px dashed #ddd;
    border-radius: 15px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
}

.upload-container:hover {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.05);
}

.upload-container.drag-over {
    border-color: var(--accent-color);
    background-color: rgba(247, 37, 133, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

#file-input {
    display: none;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    outline: none;
    margin: 0.5rem;
    background-color: var(--primary-color);
    color: white;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 14px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
}

.btn-accent {
    background: linear-gradient(45deg, var(--accent-color), var(--primary-color));
}

.btn-download {
    background: linear-gradient(45deg, var(--success-color), var(--primary-color));
    display: none;
}

.processing-bar {
    width: 100%;
    height: 6px;
    background-color: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 1rem;
    display: none;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    width: 0%;
    transition: width 0.3s ease;
}

.image-preview {
    display: none;
    width: 100%;
    margin-top: 2rem;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.preview-box {
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.preview-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.preview-title {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.preview-img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    background-color: #f5f5f5;
    background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%, #ddd),
                      linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%, #ddd);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-img img {
    max-width: 100%;
    max-height: 100%;
}

.actions-container {
    text-align: center;
    margin-top: 2rem;
}

.format-options, .resolution-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.format-option, .resolution-option {
    background-color: white;
    border: 2px solid #ddd;
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.format-option.active, .resolution-option.active {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.selection-tools {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.background-picker {
    display: inline-block;
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    overflow: hidden;
    cursor: pointer;
}

.background-picker input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.background-color-preview {
    width: 100%;
    height: 100%;
    background-color: transparent;
}

.tool-buttons {
    display: flex;
    gap: 0.5rem;
}

.tool-btn {
    padding: 0.5rem;
    border-radius: 50%;
    background-color: white;
    border: 2px solid #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tool-btn.active {
    border-color: var(--primary-color);
    background-color: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.tool-btn i {
    font-size: 1.2rem;
    color: var(--dark-color);
}

.tool-btn.active i {
    color: var(--primary-color);
}

.error-message {
    color: #e63946;
    text-align: center;
    margin-top: 1rem;
    display: none;
}

.features {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
}

.feature-card {
    flex: 1;
    min-width: 250px;
    background-color: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.loader {
    display: none;
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    margin: 1rem auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    margin-top: auto;
    padding: 1.5rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .preview-container {
        flex-direction: column;
        align-items: center;
    }
    
    .preview-box {
        width: 100%;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 15px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.preview-controls {
    margin-top: 1rem;
    text-align: center;
}

.preview-background {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
}

.bg-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #ddd;
}

.bg-option.active {
    border-color: var(--primary-color);
}

.bg-white { background: white; }
.bg-black { background: black; }
.bg-checkered {
    background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
                    linear-gradient(-45deg, #ccc 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #ccc 75%),
                    linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.optimization-options {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.optimization-options h4 {
    margin-bottom: 0.5rem;
}

.optimization-slider {
    width: 100%;
    margin: 0.5rem 0;
}

.optimization-value {
    font-size: 0.9rem;
    color: #666;
}

.drag-handle {
    cursor: move;
    padding: 0.5rem;
    background: rgba(0,0,0,0.05);
    border-radius: 5px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

#modalPreview {
    position: relative;
    overflow: hidden;
    background-size: 20px 20px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#previewImage {
    cursor: move;
    max-width: 100%;
    max-height: 70vh;
    user-select: none;
    position: relative;
}

.image-info {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.processing-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.processing-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    max-width: 90%;
    width: 400px;
}

.processing-steps {
    margin: 1.5rem 0;
    text-align: left;
}

.step {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
    padding: 0.5rem;
    border-radius: 5px;
    background: #f8f9fa;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.step.active {
    opacity: 1;
    background: #e3f2fd;
}

.step.completed {
    opacity: 1;
    background: #e8f5e9;
}

.step-icon {
    margin-right: 10px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.step.active .step-spinner {
    display: block;
}

.step-check {
    color: #4caf50;
    display: none;
}

.step.completed .step-check {
    display: block;
}

.progress-detail {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin: 1rem 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Background Options Styles */
.background-options {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.background-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.bg-tab {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.bg-tab.active {
    background: var(--primary-color);
    color: white;
}

.bg-content {
    display: none;
    padding: 1rem 0;
}

.bg-content.active {
    display: block;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: transform 0.2s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: var(--primary-color);
}

#customColor {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

.template-option {
    height: 80px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid #ddd;
    background-size: cover;
    background-position: center;
    transition: transform 0.2s ease;
}

.template-option:hover {
    transform: scale(1.05);
}

.template-option.active {
    border-color: var(--primary-color);
}

/* Template backgrounds */
.template-option[data-template="gradient1"] {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
}

.template-option[data-template="pattern1"] {
    background-image: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><rect width="20" height="20" fill="%23f8f9fa"/><circle cx="10" cy="10" r="2" fill="%23ddd"/></svg>');
    background-repeat: repeat;
}

.template-option[data-template="scene1"] {
    background: linear-gradient(to bottom, #87CEEB, #3498db);
}

.template-option[data-template="abstract1"] {
    background: radial-gradient(circle at 50% 50%, #ff6b6b, #4ecdc4, #45b7d1);
}

.custom-bg-upload {
    text-align: center;
    padding: 1rem;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

#bgFileInput {
    display: none;
}

.blur-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#blurLevel {
    flex: 1;
}

.ai-prompt {
    display: flex;
    gap: 0.5rem;
}

#aiPrompt {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Loading state for AI generation */
.generating {
    position: relative;
    pointer-events: none;
}

.generating::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .background-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

/* HD Enhancement Options */
.hd-enhancement-options {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.enhancement-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.enhancement-option {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.enhancement-option label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

#upscaleFactor {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.enhancement-sliders {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #eee;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-group label {
    min-width: 120px;
}

.slider-group input[type="range"] {
    flex: 1;
}

.slider-group span {
    min-width: 50px;
    text-align: right;
    color: #666;
}

.enhancement-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.preset-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

#applyHdEnhancement {
    width: 100%;
    margin-top: 1rem;
}

/* Loading state for HD enhancement */
.enhancing {
    position: relative;
    pointer-events: none;
}

.enhancing::after {
    content: 'Sedang meningkatkan kualiti...';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    color: var(--primary-color);
}

@media (max-width: 768px) {
    .enhancement-option {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .slider-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .slider-group label {
        min-width: auto;
    }
    
    .slider-group span {
        text-align: left;
    }
} 