:root {
    /* Color Palette */
    --primary: #c13584; /* Instagram purplish pink */
    --primary-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --bg-dark: #0f1015;
    --text-main: #f8f9fa;
    --text-muted: #a0a4b8;
    
    /* Glassmorphism */
    --glass-bg: rgba(25, 27, 36, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    
    /* UI */
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Dynamic Background Orbs */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.shape-1 {
    top: 10%;
    left: 15%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(220,39,67,0.4) 0%, rgba(204,35,102,0) 70%);
    animation-delay: 0s;
}

.shape-2 {
    bottom: 5%;
    right: 10%;
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, rgba(144,32,171,0.4) 0%, rgba(131,58,180,0) 70%);
    animation-delay: -5s;
}

.shape-3 {
    top: 40%;
    left: 60%;
    width: 25vw;
    height: 25vw;
    background: radial-gradient(circle, rgba(245,150,55,0.3) 0%, rgba(240,148,51,0) 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(5%, 10%) scale(1.1); }
    66% { transform: translate(-5%, 5%) scale(0.9); }
    100% { transform: translate(10%, -5%) scale(1.05); }
}

/* Layout */
.container {
    width: 100%;
    max-width: 1100px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo i {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.app-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Glass Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    position: relative;
}

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

/* Upload Area */
.upload-area {
    padding: 4rem 2rem;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-md);
    padding: 4rem 2rem;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.02);
}

.upload-label:hover, .upload-label.dragover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: var(--transition);
}

.upload-label:hover .upload-icon {
    transform: scale(1.1);
}

.upload-label h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

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

.file-hint {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(0,0,0,0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    min-height: 600px;
}

/* Controls Sidebar */
.controls {
    padding: 2.5rem;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.control-group h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Format Selector Cards */
.format-selector {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.card-content {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    gap: 1rem;
}

.radio-card:hover .card-content {
    background: rgba(255, 255, 255, 0.08);
}

.radio-card input:checked + .card-content {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(193, 53, 132, 0.2);
}

/* Aspect Ratio Icons */
.icon {
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    transition: var(--transition);
}

.radio-card input:checked + .card-content .icon {
    border-color: #fff;
    background: var(--primary-gradient);
}

.square-icon { width: 24px; height: 24px; }
.portrait-icon { width: 22px; height: 28px; }
.story-icon { width: 18px; height: 32px; }

.card-content span {
    font-weight: 500;
    flex-grow: 1;
}

.card-content small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Background Options Adjustments */
.background-options {
    flex-direction: row;
    gap: 0.5rem;
}

.background-options .radio-card {
    flex: 1;
}

.background-options .card-content {
    justify-content: center;
    padding: 0.75rem 0.5rem;
    text-align: center;
}

/* Slider Customization */
.toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.toggle-header h3 {
    margin: 0;
}

.toggle-header span {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;   
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%; 
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Buttons */
.action-buttons {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 39, 67, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 39, 67, 0.5);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Preview Area */
.preview-container {
    padding: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%) 50% / 40px 40px;
}

.canvas-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: hidden;
}

canvas {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    transition: all 0.3s ease;
}

/* Carousel Additions */
.carousel-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    z-index: 10;
    margin: 0 1rem;
    flex-shrink: 0;
}

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

.carousel-btn:disabled {
    opacity: 0.3;
    cursor: default;
    transform: none;
}

.carousel-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
    background: rgba(0,0,0,0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: var(--transition);
}

.dot.active {
    background: white;
    transform: scale(1.2);
}

.carousel-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
    z-index: 10;
}

/* Footer */
footer {
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    padding-bottom: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
    
    .controls {
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }
    
    .format-selector {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .radio-card {
        flex: 1;
        min-width: 150px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .canvas-wrapper {
        max-height: 50vh;
    }
}
