:root {
    --accent-color: #f0363d;
    --accent-hover: #d62e34;
    --text-primary: #333;
    --text-secondary: #666;
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background: var(--bg-secondary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout split */
.layout {
    height: 100vh;
    width: 100%;
}

.container {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    background: radial-gradient(circle farthest-corner at right bottom, #8a5353 20%, #d03838 50%, #712121 100%);
}

#preview {
    display: none;
    background: #000;
    overflow: hidden;
    position: relative;
}

.preview-content {
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* When Step 2 is active, split the layout */
body.show-preview .layout {
    display: flex;
}

body.show-preview .container {
    flex: 0 0 50%;
    width: 50%;
}

body.show-preview #preview {
    display: flex;
    flex: 1;
}

/* Preview background slideshow */
.preview-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
}

.preview-background.single-image {
    animation: zoomIn 20s ease-in-out infinite;
}

.preview-background-slideshow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.preview-background-slideshow .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.preview-background-slideshow .slide.animated {
    opacity: 1;
    animation: anisplash 3s infinite;
    -webkit-animation: anisplash 3s infinite;
    -moz-animation: anisplash 3s infinite;
}

@keyframes zoomIn {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes zoomSlideShow {
    0% {
        opacity: 0;
        transform: scale(1);
    }
    10% {
        opacity: 1;
    }
    40% {
        opacity: 1;
        transform: scale(1.1);
    }
    50% {
        opacity: 0;
        transform: scale(1.15);
    }
    100% {
        opacity: 0;
        transform: scale(1);
    }
}

/* Partners strip under Step 3 */
.partners {
    margin-top: 24px;
}

.partners-title {
    text-align: center;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.partners-logos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    align-items: center;
    padding: 4px 2px;
}

.partners-logos img {
    height: 32px; /* uniform height */
    width: auto;
    max-width: 100%;
    justify-self: center;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.6) translateY(10px);
    animation: popIn 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Stagger animation delays for each image */
.partners-logos img:nth-child(1) { animation-delay: 0.1s; }
.partners-logos img:nth-child(2) { animation-delay: 0.15s; }
.partners-logos img:nth-child(3) { animation-delay: 0.2s; }
.partners-logos img:nth-child(4) { animation-delay: 0.25s; }
.partners-logos img:nth-child(5) { animation-delay: 0.3s; }
.partners-logos img:nth-child(6) { animation-delay: 0.35s; }
.partners-logos img:nth-child(7) { animation-delay: 0.4s; }
.partners-logos img:nth-child(8) { animation-delay: 0.45s; }
.partners-logos img:nth-child(9) { animation-delay: 0.5s; }
.partners-logos img:nth-child(10) { animation-delay: 0.55s; }
.partners-logos img:nth-child(11) { animation-delay: 0.6s; }
.partners-logos img:nth-child(12) { animation-delay: 0.65s; }
.partners-logos img:nth-child(13) { animation-delay: 0.7s; }
.partners-logos img:nth-child(14) { animation-delay: 0.75s; }
.partners-logos img:nth-child(15) { animation-delay: 0.8s; }
.partners-logos img:nth-child(n+16) { animation-delay: 0.85s; }

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
    60% {
        opacity: 1;
        transform: scale(1.05) translateY(0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@media (min-width: 768px) {
    .partners-logos img {
        height: 36px;
    }
}

@media (min-width: 1024px) {
    .partners-logos img {
        height: 40px;
    }
}

.step {
    width: 100%;
    max-width: 600px;
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 32px 24px;
    box-shadow: var(--shadow-lg);
    position: absolute;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.step.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: all;
}

.step.slide-out {
    transform: translateX(-100%);
    opacity: 0;
}

.step-content {
    width: 100%;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    text-align: center;
}

.step-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

.message {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    text-align: center;
}

.form {
    width: 100%;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(240, 54, 61, 0.1);
}

.form-group input::placeholder {
    color: #999;
}

#errImages {
    display: none;
    background: #7d83c5;
    color: white;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Step 2 Styles */

.step-2 .step-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.step-2 .btn {
    margin-top: 24px;
    flex-shrink: 0;
}

.section {
    flex: 0 0 auto;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
/*    min-height: calc(33.333vh - 40px);*/
/*    max-height: calc(33.333vh - 40px);*/
}

.section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: rgba(240, 54, 61, 0.05);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.checkbox-label span {
    font-size: 16px;
    color: var(--text-primary);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding: 0;
    min-height: 0;
}

.image-grid::-webkit-scrollbar {
    width: 6px;
}

.image-grid::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 3px;
}

.image-grid::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: var(--bg-secondary);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.image-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(240, 54, 61, 0.2);
}

.image-item .checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
}

.logo-grid {
    flex: 1;
    min-height: 0;
}

.logo-grid .image-item:hover {
    transform: none;
}

/* Ad Cards */
.adcards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.adcard-item {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16; /* mobile phone ratio */
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    background: var(--bg-primary);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.adcard-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.adcard-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.adcard-item.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(240, 54, 61, 0.2);
}

.adcard-item .checkmark {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-overlay .step {
    position: relative;
    opacity: 1;
    transform: none;
    pointer-events: all;
    margin: 0;
}

#step3{
    margin-left: 0;
}

/* Responsive Design */
@media (min-width: 768px) {
    .container {
        padding: 20px;
    }

    .step {
        padding: 24px 20px;
    }

    .step-2 {
        /* max-height: 98vh; */
        /* height: 100%; */
        top: 10px;
    }

    .step-2 .step-content {
        gap: 20px;
    }

    .section {
/*        min-height: calc(33.333vh - 60px);*/
/*        max-height: calc(33.333vh - 60px);*/
        padding: 20px;
    }

    .title {
        font-size: 36px;
    }

    .subtitle {
        font-size: 18px;
    }

    .step-title {
        font-size: 28px;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 16px;
    }

    .checkbox-group {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .checkbox-label {
        flex: 0 0 calc(50% - 6px);
    }
}

@media (min-width: 1024px) {
    .step {
        max-width: 700px;
        padding: 56px 48px;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .checkbox-label {
        flex: 0 0 calc(33.333% - 8px);
    }
}

/* Animation for slide effect */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes anisplash {
    0% {transform: scale(1);}
    10% {transform: scale(1);}
    100% {transform: scale(1.1); }
    }
    
    @-webkit-keyframes anisplash {
    0% {transform: scale(1);}
    10% {transform: scale(1);}
    100% {transform: scale(1.1); }
    }

.slide.animated{
    animation: anisplash 4s;
    -webkit-animation: anisplash 4s;
    -moz-animation: anisplash 4s;
}

/* Background Images Slider */
.background-slider-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.background-slider-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.background-grid-slider {
    display: flex;
    gap: 0;
    transition: transform 0.3s ease-in-out;
    will-change: transform;
}

.slider-page {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    flex-shrink: 0;
    min-width: 0;
    overflow-x: visible;
    overflow-y: visible;
}

.slider-nav-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.slider-nav-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.slider-nav-btn:active {
    transform: scale(0.95);
}

.slider-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.slider-nav-btn svg {
    width: 20px;
    height: 20px;
}

@media (min-width: 768px) {
    .slider-page {
        gap: 16px;
    }
    
    .slider-nav-btn {
        width: 40px;
        height: 40px;
    }
}

.slider-page{
    overflow: hidden;
}