:root {
    --primary-color: #6200ea;
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.image-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.image-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.upload-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 250px;
    border: 2px dashed #ccc;
    background: transparent;
}

.upload-card:hover {
    border-color: var(--primary-color);
    background: rgba(98, 0, 234, 0.05);
}

.upload-icon {
    font-size: 3rem;
    color: #888;
}

/* Modal Styles */
.editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.editor-modal.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.editor-container {
    width: 90vw;
    height: 90vh;
    background: #000;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.flutter-view {
    width: 100%;
    height: 100%;
}

.close-editor-btn {
    position: absolute;
    top: 10px;
    left: 60px;
    /* Shifted right to avoid back button overlap */
    right: auto;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    color: white;
    cursor: pointer;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-editor-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.result-section.hidden {
    display: none;
}

.result-container img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

button:first-child {
    background: var(--primary-color);
    color: white;
}

button:last-child {
    background: #ddd;
    color: #333;
}