* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #1a2a6c);
    color: white;
    min-height: 100vh;
    padding: 20px;
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(45deg, #4da6ff, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.app-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.panel {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideIn 0.6s ease-out;
}

.panel:nth-child(1) { animation-delay: 0.2s; }
.panel:nth-child(2) { animation-delay: 0.4s; }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

.panel-title {
    font-size: 1.6rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-title i {
    color: #4da6ff;
}

.upload-area {
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    margin-bottom: 25px;
    transition: all 0.3s;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: #4da6ff;
    background: rgba(0, 0, 0, 0.3);
}

.upload-area i {
    font-size: 4rem;
    margin-bottom: 15px;
    color: #4da6ff;
}

.upload-area h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.upload-area p {
    opacity: 0.8;
    margin-bottom: 15px;
}

.btn {
    background: linear-gradient(45deg, #4da6ff, #1a75ff);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 2;
    position: relative;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: linear-gradient(45deg, #ff6b6b, #ff1a1a);
}

.btn-success {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    opacity: 0.7;
}

.image-grid-container {
    margin-bottom: 25px;
}

.layout-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.layout-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.layout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.layout-btn.active {
    background: rgba(77, 166, 255, 0.3);
    border-color: #4da6ff;
}

.layout-preview {
    display: grid;
    gap: 3px;
    margin-top: 5px;
}

.layout-preview-cell {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.image-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 25px;
}

.grid-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.grid-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.grid-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.grid-item .controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.grid-item:hover .controls {
    opacity: 1;
}

.control-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.preview-container {
    text-align: center;
    margin-bottom: 25px;
}

#previewCanvas {
    max-width: 100%;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: none;
}

.actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 15px 0;
}

.status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    display: none;
}

.success {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid rgba(46, 204, 113, 0.5);
}

.error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid rgba(231, 76, 60, 0.5);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.file-info img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.file-size {
    font-size: 0.85rem;
    opacity: 0.8;
}

.instructions {
    background: rgba(0, 0, 0, 0.3);
    padding: 25px;
    border-radius: 15px;
    margin-top: 30px;
    animation: fadeIn 1s ease-out;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.instructions h2 {
    margin-bottom: 20px;
    font-size: 1.6rem;
    color: #4da6ff;
    text-align: center;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.step-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    transition: transform 0.3s;
}

.step-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.step-number {
    width: 40px;
    height: 40px;
    background: #4da6ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.step-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: #4da6ff;
}

.step-card p {
    line-height: 1.6;
    opacity: 0.9;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 15px 0;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #4da6ff, #ff6b6b);
    width: 0%;
    transition: width 0.5s;
}

.metadata-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    display: none;
}

.metadata-row {
    display: flex;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.metadata-label {
    width: 120px;
    opacity: 0.8;
}

.metadata-value {
    flex: 1;
}

@media (max-width: 900px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .panel {
        padding: 15px;
    }
    
    .upload-area {
        padding: 20px;
    }
    
    .step-card {
        padding: 15px;
    }
    
    .layout-selector {
        flex-direction: column;
        align-items: center;
    }
}