:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e2e8f0;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-main: #1e293b;
    --text-secondary: #64748b;
    --error-color: #ef4444;
    --success-color: #10b981;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 500px;
    position: relative;
    /* transition: max-width 0.3s ease; */
}

.container.wide {
    max-width: 900px;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Controls */
.controls {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid transparent;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.icon-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Views */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Upload Area */
.upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 3rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.3);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    color: #94a3b8;
    margin-bottom: 1rem;
}

.upload-text {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Settings Panel */
.settings-panel {
    margin-bottom: 1.5rem;
    display: none;
    background: rgba(255, 255, 255, 0.4);
    padding: 1rem;
    border-radius: 12px;
}

.settings-panel.show {
    display: block;
}

.modern-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
}

.modern-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Progress & Result */
.progress-container {
    margin-top: 1.5rem;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    display: none;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.1s linear;
}

.result-section {
    margin-top: 2rem;
    display: none;
}

.preview-container {
    width: 100%;
    height: 200px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.copy-group {
    display: flex;
    gap: 0.5rem;
}

.copy-btn {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #f8fafc;
}

/* Status */
.status-message {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.4em;
}

.status-message.error {
    color: var(--error-color);
}

.status-message.success {
    color: var(--success-color);
}

/* --- GALLERY GRID --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding-top: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.5);
    group: hover;
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s;
}

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

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    padding: 0.5rem;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.overlay-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.overlay-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.overlay-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.load-more-btn {
    width: 100%;
    padding: 1rem;
    margin-top: 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.load-more-btn:hover {
    background: rgba(255, 255, 255, 0.8);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem;
}