* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.upload-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.upload-section:hover {
    transform: translateY(-5px);
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
}

.upload-area:hover {
    border-color: #764ba2;
    background: linear-gradient(135deg, #f0f2ff 0%, #e8ebff 100%);
    transform: scale(1.02);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: linear-gradient(135deg, #e8ebff 0%, #dde2ff 100%);
    transform: scale(1.05);
}

.upload-icon {
    width: 60px;
    height: 60px;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.upload-content p {
    color: #666;
    font-size: 1rem;
}

.editor-section {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#imageCanvas {
    max-width: 100%;
    max-height: 600px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    background: #f8f9fa;
}

.image-info {
    margin-top: 15px;
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
}

.metadata-section {
    margin-top: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    width: 100%;
}

.metadata-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.metadata-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e9ecef;
}

.tab-button {
    padding: 10px 20px;
    border: none;
    background: #f8f9fa;
    color: #666;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.tab-button:hover {
    background: #e9ecef;
    color: #333;
}

.tab-button.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.metadata-content {
    position: relative;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.metadata-group {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.metadata-group h4 {
    margin-bottom: 15px;
    color: #555;
    font-size: 1.1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.reset-group-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    font-weight: 600;
}

.reset-group-btn:hover {
    background: #ff5252;
    transform: translateY(-1px);
}

.metadata-field {
    margin-bottom: 15px;
}

.metadata-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.9rem;
}

.metadata-field input,
.metadata-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    background: white;
}

.metadata-field input:focus,
.metadata-field textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.metadata-field textarea {
    resize: vertical;
    min-height: 60px;
}

.metadata-value {
    display: block;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
    border: 1px solid #e9ecef;
    min-height: 20px;
}

.controls-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    height: fit-content;
}

.control-group {
    margin-bottom: 30px;
}

.control-group h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.control {
    margin-bottom: 20px;
}

.control label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95rem;
}

.control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}

.control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.control input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.control .value {
    float: right;
    font-weight: 600;
    color: #667eea;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: right;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-2px);
}

.image-gallery {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-top: 30px;
}

.image-gallery h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.gallery-item.active {
    border: 3px solid #667eea;
    transform: scale(1.05);
}

.gallery-item .image-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 10px 8px 8px;
    font-size: 0.8rem;
    text-align: center;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .editor-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .controls-panel {
        order: -1;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

@media (max-width: 480px) {
    .upload-area {
        padding: 30px 15px;
    }
    
    .upload-content h3 {
        font-size: 1.2rem;
    }
    
    .controls-panel {
        padding: 20px;
    }
    
    .control-group h3 {
        font-size: 1.1rem;
    }
}
