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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #7c3aed;
    --secondary-hover: #6d28d9;
    --accent: #06b6d4;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --error: #ef4444;
    --success: #22c55e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    text-decoration: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.brand:hover {
    transform: scale(1.02);
    opacity: 0.9;
}

.brand-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 1px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    flex: 1;
}

/* Upload Section */
.upload-section {
    max-width: 600px;
    margin: 0 auto;
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    background: var(--bg-card);
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.upload-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.upload-btn:hover {
    background: var(--primary-hover);
}

.supported-formats {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.error-message {
    color: var(--error);
    text-align: center;
    margin-top: 1rem;
    font-weight: 500;
    min-height: 1.5rem;
}

/* Editor Section */
.editor-section {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
}

@media (max-width: 900px) {
    .editor-section {
        grid-template-columns: 1fr;
    }
}

.preview-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
}

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

.preview-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.change-image-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.change-image-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.preview-wrapper {
    background: repeating-conic-gradient(#1a1a2e 0% 25%, #252538 0% 50%) 50% / 20px 20px;
    border-radius: 8px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-wrapper img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.image-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.image-info span {
    color: var(--text);
    font-weight: 500;
}

/* Controls */
.controls-container {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
}

.controls-container h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.control-group {
    margin-bottom: 1.25rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.control-group .optional {
    color: var(--text-muted);
    font-weight: 400;
}

.control-group input[type="number"],
.control-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.control-group input[type="number"]:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.control-group input[type="number"]::placeholder {
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.resize-btn,
.download-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.resize-btn:hover {
    background: var(--primary-hover);
}

.resize-btn:disabled {
    background: var(--bg-hover);
    cursor: not-allowed;
}

.download-btn {
    background: linear-gradient(135deg, var(--accent), #0891b2);
    color: white;
}

.download-btn:hover {
    background: linear-gradient(135deg, #0891b2, var(--accent));
}

.output-info {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--success);
    border-radius: 8px;
    font-size: 0.875rem;
}

.output-info p {
    margin-bottom: 0.25rem;
}

.output-info span {
    color: var(--success);
    font-weight: 600;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-tagline {
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-copyright a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-copyright a:hover {
    color: var(--primary);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-links .divider {
    color: var(--border);
}

.footer-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor-section {
    animation: fadeIn 0.3s ease;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }

    .preview-wrapper {
        min-height: 200px;
    }

    .preview-wrapper img {
        max-height: 300px;
    }
}
