@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary: #772FD3;
    --secondary: #2D0A5A;
    --accent: #FFE144;
    --sand: #F8F9FF;
    --white: #ffffff;
    --glass: rgba(255, 255, 255, 0.7);
    --shadow-soft: 0 20px 40px rgba(119, 47, 211, 0.08);
    --shadow-strong: 0 30px 60px rgba(45, 10, 90, 0.15);
    --transition-fluid: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.reunion-premium-generator {
    max-width: 1200px;
    margin: 40px auto;
    background: var(--sand);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: var(--shadow-strong);
    font-family: 'Outfit', sans-serif;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.reunion-premium-generator::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.2;
    z-index: 0;
    pointer-events: none;
}

/* Stepper */
.stepper {
    display: flex;
    background: var(--white);
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    justify-content: center;
    gap: 15px;
    z-index: 1;
    position: relative;
    flex-wrap: wrap;
}

@media (min-width: 768px) {
    .stepper {
        padding: 25px 40px;
        justify-content: flex-start;
        gap: 40px;
    }
}

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #A0AEC0;
    font-size: 1rem;
    transition: var(--transition-fluid);
    position: relative;
}

.step span {
    width: 36px;
    height: 36px;
    background: #F7FAFC;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0.9rem;
    border: 2px solid transparent;
    transition: var(--transition-fluid);
}

.step.active {
    color: var(--secondary);
}

.step.active span {
    background: var(--primary);
    color: white;
    box-shadow: 0 8px 15px rgba(119, 47, 211, 0.2);
    transform: scale(1.1);
}

/* Layout */
.generator-main {
    display: grid;
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 20px;
    z-index: 1;
    position: relative;
}

@media (min-width: 1000px) {
    .reunion-premium-generator[data-step="3"] .generator-main {
        grid-template-columns: 1.2fr 1fr;
        padding: 40px;
        gap: 40px;
    }

    .reunion-premium-generator[data-step="1"] .generator-main,
    .reunion-premium-generator[data-step="2"] .generator-main {
        max-width: 600px;
        margin: 0 auto;
        padding: 40px;
    }
}

.reunion-premium-generator[data-step="1"] .canvas-wrapper,
.reunion-premium-generator[data-step="2"] .canvas-wrapper {
    display: none;
}

/* Canvas Wrapper */
.canvas-wrapper {
    background: #eef2f7;
    border-radius: 24px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    max-height: 70vh;
    aspect-ratio: 1/1;
}

/* Aspect Ratios */
.reunion-premium-generator[data-ratio="1-1"] .canvas-wrapper {
    aspect-ratio: 1/1;
}

.reunion-premium-generator[data-ratio="4-5"] .canvas-wrapper {
    aspect-ratio: 4/5;
}

.reunion-premium-generator[data-ratio="9-16"] .canvas-wrapper {
    aspect-ratio: 9/16;
}

/* Controls */
.controls-container {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-soft);
    width: 100%;
    min-height: 400px;
}

.control-panel {
    display: none;
    animation: slideIn 0.4s cubic-bezier(0, 0, 0.2, 1);
}

.control-panel.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.control-panel h3 {
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--secondary);
}

/* Sub Label */
.sub-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--secondary);
    margin: 20px 0 10px;
    letter-spacing: 1px;
    opacity: 0.6;
}

/* Ratio Selector */
.ratio-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.ratio-btn {
    flex: 1;
    background: #fff;
    border: 2px solid #eee;
    padding: 15px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
}

.ratio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.05);
}

.ratio-btn.active {
    border-color: var(--primary);
    background: #fff5f5;
}

.ratio-btn span {
    font-size: 0.75rem;
    font-weight: 700;
}

/* Ratio Icons */
.ratio-icon {
    background: #ddd;
    border-radius: 2px;
}

.ratio-icon.square {
    width: 14px;
    height: 14px;
}

.ratio-icon.portrait {
    width: 12px;
    height: 15px;
}

.ratio-icon.story {
    width: 10px;
    height: 18px;
}

/* Template Selector */
.template-selector.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.template-option {
    cursor: pointer;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid transparent;
    transition: all 0.3s;
}

.template-option img {
    width: 100%;
    display: block;
}

.template-option.active {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.check-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0;
    transition: 0.3s;
}

.template-option.active .check-badge {
    opacity: 1;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--accent);
    background: var(--white);
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
    margin-bottom: 20px;
}

.upload-zone:hover,
.upload-zone.dragover {
    background: #f0f7f7;
    border-color: var(--primary);
}

.upload-zone i {
    font-size: 50px;
    color: var(--accent);
    display: block;
    margin-bottom: 10px;
}

/* Buttons */
.reunion-button {
    width: 100%;
    padding: 18px;
    border-radius: 14px;
    border: none;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: var(--secondary);
    color: white;
}

.reunion-button.primary {
    background: linear-gradient(135deg, var(--primary), #9B5DE5);
    box-shadow: 0 10px 20px rgba(119, 47, 211, 0.3);
    padding: 22px;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    border-radius: 18px;
}

.reunion-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.reunion-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reunion-button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.reunion-button.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    margin-left: -12px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pulse {
    animation: premium-pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes premium-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.03);
        opacity: 0.95;
    }
}

.navigation-btns {
    display: flex;
    align-items: center;
    gap: 20px;
}

.reunion-link {
    background: none;
    border: none;
    color: var(--secondary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

/* Canvas */
#reunion-canvas {
    width: 100%;
    height: 100%;
    cursor: move;
}

#canvas-placeholder {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 24px;
    backdrop-filter: blur(5px);
}

.loader-icon {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tip {
    font-size: 0.85rem;
    opacity: 0.6;
    margin-top: 10px;
    font-style: italic;
}

/* Footer */
.generator-footer {
    padding: 30px;
    background: var(--secondary);
    display: flex;
    justify-content: center;
    gap: 20px;
}

.generator-footer p {
    margin: 0;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}