/* --- Global Reset & Body --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0e1217;
    min-height: 100vh;
    padding: 0;
    overflow-x: hidden;
}

/* --- Layout Containers (Pollo.ai Style) --- */
.video-generator-container {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    width: 100%;
    margin: 0;
    padding: 0.5rem 1.5rem 4rem 1.5rem;
    padding-bottom: 4rem;
    min-height: 100vh;
    box-sizing: border-box;
}

.left-panel {
    flex: 0 0 420px;
    background: #1a1f28;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border-radius: 12px;
    border: 1px solid rgba(100, 116, 139, 0.3);
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.left-panel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.right-panel {
    flex: 1;
    background: #1a1f28;;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid rgba(100, 116, 139, 0.3);
    overflow-y: auto;
    max-height: calc(100vh - 4rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.right-panel{
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.right-panel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* --- Dropdown Layout --- */
.dropdown-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.dropdown-group {
    display: flex;
    flex-direction: column;
}

.dropdown-label {
    font-size: 0.875rem;
    color: #e5e7eb;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.dropdown-box select,
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    background: #2d3748 url("data:image/svg+xml;utf8,<svg fill='%23f3f4f6' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>") no-repeat right 12px center;
    background-size: 16px;
    border: 2px solid rgba(100, 116, 139, 0.3);
    color: #f3f4f6;
    border-radius: 8px;
    padding: 10px 38px 10px 12px; /* extra space for icon */
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    background-color: #2d3748;
    border-color: rgba(100, 116, 139, 0.3);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
    /* keep icon visible */
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23f3f4f6' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

select:focus {
    background-color: #2d3748;
    border-color: rgba(100, 116, 139, 0.3);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
    /* keep icon visible */
    background-image: url("data:image/svg+xml;utf8,<svg fill='%23f3f4f6' height='18' viewBox='0 0 24 24' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}



/* --- Prompt Box --- */
.prompt-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prompt-box textarea {
    width: 100%;
    background: #2d3748;
    border: 1px solid rgba(100, 116, 139, 0.3);
    color: #f3f4f6;
    border-radius: 10px;
    padding: 12px;
    resize: none;
    font-size: 0.9rem;
    min-height: 120px;
    transition: all 0.3s ease;
    font-family: inherit;
    outline: none;
}

.prompt-box textarea::placeholder {
    color: #9ca3af;
}

.prompt-box textarea:focus {
    border-color: rgba(148, 163, 184, 0.6);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
}

.prompt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Enhance Button */
.enhance-btn {
    background: linear-gradient(135deg, #9b297a, #752161);
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(134, 38, 130, 0.3);
    transition: all 0.3s ease;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.enhance-btn:hover {
    background: linear-gradient(135deg, #752161, #54194d);
    box-shadow: 0 4px 12px rgba(134, 38, 130, 0.4);
    transform: translateY(-1px);
}

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

/* Delete Button */
.delete-btn {
    background-color: #313a45;
    border: 1px solid rgba(255, 99, 71, 0.4);
    color: #ff6347;
    padding: 10px;
    border-radius: 8px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background-color: #ff6347;
    color: white;
}

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

/* --- Token Cost --- */
#token-cost {
    background: #2d3748;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(100, 116, 139, 0.3);
    text-align: center;
    color: #cc78c9;
    font-size: 0.9rem;
}

#token-cost span {
    font-weight: 700;
    background: linear-gradient(90deg, #ff6fd8, #3813c2); /* choose any gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Control Section --- */
.control-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button-group-img {
    width: 100%;
}

/* Generate Button */
.generate-btn {
    background: linear-gradient(135deg, #9b297a, #752161);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 12px rgba(134, 38, 130, 0.4);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    font-size: 1rem;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #752161, #54194d);
    box-shadow: 0 6px 16px rgba(134, 38, 130, 0.5);
    transform: translateY(-2px);
}

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

.checkbox-section label {
    background: linear-gradient(90deg, #ff6fd8, #3813c2); /* choose any gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 0.85rem;
    font-weight: 500;
}

/* --- Loader --- */
#loader {
    background: #28303a;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(134, 38, 130, 0.3);
    text-align: center;
    animation: pulse 2s infinite;
}

#loader-text {
    color: #cc78c9;
    font-size: 0.95rem;
    margin: 0;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* --- Right Panel --- */
.right-panel h5 {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.5rem;
}

.sub-header {
    color: #e5e7eb;
    font-size: 1.25rem;
}

/* Result Section - Enhanced for better video display */
#result-section {
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 12px;
    min-height: 500px;
    background-color: #0e1217;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#result-section video {
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

#result-section:empty::after {
    content: 'Your generated video will appear here';
    color: #6c757d;
    opacity: 0.75;        /* muted effect */
    font-size: 1rem;
    font-weight: 400;     /* optional */
}

/* --- Previous Videos Container (New Grid System) --- */
.previous-videos-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 0.5rem !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.previous-videos-container > div {
    margin: 0 !important;
    padding: 0 !important;
}

.previous-videos-container .card {
    background: #1e242c;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(134, 38, 130, 0.2);
    aspect-ratio: 16/9;
    margin: 0;
}

.previous-videos-container .card:hover {
    transform: translateY(-4px);
    border-color: rgba(134, 38, 130, 0.5);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.previous-videos-container .card video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* --- Old Grid System (for backwards compatibility) --- */
.previous-images-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 0.5rem !important;
    max-width: 100% !important;
}

.previous-images-grid .card {
    background: #1e242c;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(134, 38, 130, 0.2);
    aspect-ratio: 16/9;
}

.previous-images-grid .card:hover {
    transform: translateY(-4px);
    border-color: rgba(134, 38, 130, 0.5);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.previous-images-grid .card video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

/* --- Video Card with Download Button --- */
.video-card {
    position: relative;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: 10px;
}

.video-card:hover .video-overlay {
    opacity: 1;
    pointer-events: auto;
}

.download-btn-overlay {
    background: linear-gradient(135deg, #862682, #6b1f67);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(134, 38, 130, 0.4);
    transition: all 0.3s ease;
}

.download-btn-overlay:hover {
    background: linear-gradient(135deg, #6b1f67, #531850);
    transform: scale(1.05);
    color: white;
}

.download-btn-overlay i {
    font-size: 1.1rem;
}

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

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .video-generator-container {
        flex-direction: column;
        padding: 1rem;
        padding-bottom: 2rem;
        gap: 1rem;
    }

    .left-panel {
        flex: 0 0 auto;
        width: 100%;
        max-height: none;
        padding: 20px;
    }

    .right-panel {
        width: 100%;
        max-height: none;
        padding: 24px;
    }

    .previous-videos-container,
    .previous-images-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        gap: 0.5rem !important;
    }
    
    #result-section {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .video-generator-container {
        padding: 0.75rem;
        padding-bottom: 1.5rem;
        gap: 0.75rem;
    }

    .left-panel {
        padding: 16px;
        gap: 14px;
    }

    .right-panel {
        padding: 16px;
    }

    .dropdown-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .dropdown-label {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }

    select {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .prompt-box textarea {
        min-height: 100px;
        padding: 10px;
        font-size: 0.85rem;
    }

    .enhance-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .delete-btn {
        padding: 8px 10px;
    }

    .generate-btn {
        padding: 10px 16px;
        font-size: 0.95rem;
    }

    #result-section {
        min-height: 300px;
        padding: 15px;
    }

    #result-section:empty::after {
        font-size: 0.9rem;
    }

    .right-panel h5 {
        font-size: 1.25rem;
    }

    .sub-header {
        font-size: 1.1rem;
    }

    .previous-videos-container,
    .previous-images-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .video-generator-container {
        padding: 0.5rem;
        padding-bottom: 1rem;
        gap: 0.5rem;
    }

    .left-panel {
        padding: 12px;
        gap: 12px;
        border-radius: 8px;
    }

    .right-panel {
        padding: 12px;
        border-radius: 8px;
    }

    .dropdown-row {
        gap: 0.5rem;
    }

    .prompt-box textarea {
        min-height: 80px;
        font-size: 0.8rem;
    }

    .enhance-btn {
        padding: 8px;
        font-size: 0.8rem;
    }

    .enhance-btn i {
        display: none;
    }

    .generate-btn {
        padding: 10px;
        font-size: 0.9rem;
    }

    #result-section {
        min-height: 250px;
        padding: 10px;
        border-radius: 8px;
    }

    .right-panel h5 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .sub-header {
        font-size: 1rem;
        margin-top: 1.5rem !important;
    }

    .previous-videos-container,
    .previous-images-grid {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }

    #token-cost {
        font-size: 0.85rem;
        padding: 8px 10px;
    }
}

/* --- Preview Box Specific --- */
.preview-title {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #ffffff;
    text-align: center;
}

/* Custom Model Dropdown Styles */
.model-dropdown-wrapper {
    margin-bottom: 6px;
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #2d3748;
    border: 2px solid rgba(100, 116, 139, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dropdown-selected:hover {
    border-color: rgba(148, 163, 184, 0.6);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
    background: #374151;
}

.dropdown-selected.active {
    border-color: rgba(148, 163, 184, 0.6);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
    background: #374151;
}

.model-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

.model-info {
    flex: 1;
}

.model-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
    color: #f3f4f6;
}

.model-description {
    font-size: 0.8rem;
    color: #9ca3af;
}

.dropdown-arrow {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.dropdown-arrow.rotate {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #2d3748;
    border: 2px solid rgba(100, 116, 139, 0.3);
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.dropdown-menu.active {
    display: block;
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.dropdown-option:last-child {
    border-bottom: none;
}

.dropdown-option:hover {
    background: #374151;
}

.radio-check {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(148, 163, 184, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.dropdown-option.selected .radio-check {
    border-color: solid rgba(148, 163, 184, 0.6);

}

.radio-check::after {
    content: '';
    width: 10px;
    height: 10px;
    background: rgba(148, 163, 184, 0.6);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.dropdown-option.selected .radio-check::after {
    opacity: 1;
    transform: scale(1);
}

/* Model Icons */

.model-icon {
    width: 40px;
    height: 40px;
}

.model-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    
}

.icon-pollo {
 background: black;
    color: white;
}


.icon-veo {
    background: black;
    color: white;
}

.icon-pixverse {
    background: black;
    color: white;
    
}

.icon-pixverse img{
    transform: scale(0.8);   /* 80% of original size */
    transform-origin: center;
    
}

.dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
    background: #1a1d24;
    border-radius: 4px;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: #862682;
    border-radius: 4px;
}

.dropdown-group-stacked {
    display: flex;
    flex-direction: column;
}

/* The card */
.ratio-selector-wrapper {
    font-family: 'Montserrat', sans-serif;
}

.ratio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 12px;
}

.ratio-card {
    background: #2d3748;
    border: 2px solid rgba(100, 116, 139, 0.3);
    border-radius: 10px;
    padding: 12px;
    height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: 0.3s;
}

.ratio-card:hover {
    border-color: rgba(148, 163, 184, 0.6);
    background: #374151;
}

.ratio-card.active {
    border-color: #94a3b8;
}

/* ✅ TRUE RATIO VISUALS */
.ratio-visual {
    width: 38px;        /* fixed width */
    height: auto;       /* auto height */
    background: linear-gradient(135deg, #6b7280, #e5e7eb);
    border-radius: 6px;
}

/* ✅ LABEL ALWAYS AT BOTTOM */
.ratio-label {
    margin-top: auto;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
}

.ratio-card.active .ratio-label {
    color: #94a3b8;
}


