/* Generate Media Independent Page Styles */
.generate-media-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Show generate media section by default on this page */
#generateMediaSection {
    display: block !important;
}

.generate-media-header {
    text-align: center;
    margin-bottom: 40px;
}

.generate-media-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.generate-media-header p {
    color: #fbbf24;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Media Type Selector */
.media-type-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
    justify-content: center;
}

.media-type-btn {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(168, 85, 247, 0.3);
    color: #fff;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 120px;
    justify-content: center;
}

.media-type-btn.active {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.3);
}

.media-type-btn:hover:not(.active) {
    border-color: rgba(168, 85, 247, 0.6);
    transform: translateY(-2px);
}

/* Generate Form */
.generate-form {
    background: rgba(30, 30, 30, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 40px;
}

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

.form-group label {
    display: block;
    color: #fff;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

.form-group label i {
    margin-right: 8px;
    color: #a855f7;
}

.required {
    color: #ef4444;
    font-size: 0.9rem;
}

.optional {
    color: #6b7280;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.form-control::placeholder {
    color: #6b7280;
}

.form-control option {
    background: #1f2937;
    color: #fff;
}

/* Character and Pose Grid Layout (3:4 ratio, side by side) */
.character-pose-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.character-selector,
.pose-selector {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.character-selection-container,
.pose-selection-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    aspect-ratio: 2/3;
    max-height: 350px;
}

.character-preview-clickable,
.pose-preview-clickable {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 0.9rem;
    text-align: center;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    aspect-ratio: 2/3;
}

.character-preview-clickable:hover,
.pose-preview-clickable:hover {
    border-color: rgba(168, 85, 247, 0.6);
    background: rgba(168, 85, 247, 0.1);
    transform: translateY(-2px);
}

.character-preview-clickable.has-selection,
.pose-preview-clickable.has-selection {
    border-style: solid;
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(168, 85, 247, 0.1);
}

.character-preview-content,
.pose-preview-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

.character-preview-content i,
.pose-preview-content i {
    font-size: 2rem;
    color: #a855f7;
}

.character-preview-clickable.has-selection .character-preview-content,
.pose-preview-clickable.has-selection .pose-preview-content {
    display: none;
}

.character-preview-clickable img,
.pose-preview-clickable img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    z-index: 1;
}

.pose-preview-clickable img {
    top: 8px;
    left: 8px;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 4px;
}

.character-preview-clickable .character-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    z-index: 2;
    border-radius: 4px;
    text-align: center;
}

.pose-preview-clickable .pose-name {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    z-index: 2;
    border-radius: 4px;
    text-align: center;
}

/* Option Selectors (Tab-style) */
.option-selectors {
    margin-bottom: 25px;
}

.option-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 15px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn.active {
    background: rgba(168, 85, 247, 0.3);
    color: #fff;
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.option-buttons-container {
    position: relative;
    overflow: hidden;
}

.option-buttons {
    display: none;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 85, 247, 0.5) transparent;
}

.option-buttons.active {
    display: flex;
}

.option-buttons::-webkit-scrollbar {
    height: 6px;
}

.option-buttons::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.option-buttons::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.5);
    border-radius: 3px;
}

.option-buttons::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.7);
}

.option-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.option-btn:hover {
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(168, 85, 247, 0.1);
}

.option-btn.active {
    background: rgba(168, 85, 247, 0.3);
    border-color: #a855f7;
    color: #fff;
}

/* Image Count Selector */
.image-count-selector {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.count-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 50px;
}

.count-btn:hover {
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(168, 85, 247, 0.1);
}

.count-btn.active {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-color: transparent;
    color: #fff;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Advanced Settings */
.advanced-toggle {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
}

.advanced-toggle:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(168, 85, 247, 0.3);
}

.advanced-settings {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 15px;
}

.advanced-settings.active {
    max-height: 500px;
}

/* Generate Button */
.form-actions {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 40px;
}

.generate-btn {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border: none;
    color: white;
    padding: 18px 40px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
    justify-content: center;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(168, 85, 247, 0.4);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Generation Result */
.generation-result {
    background: rgba(30, 30, 30, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 30px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.result-header h3 {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.download-btn, .regenerate-btn {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-btn:hover, .regenerate-btn:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(168, 85, 247, 0.5);
}

.result-content {
    text-align: center;
    padding: 20px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.3);
}

/* Generating Placeholder */
.gallery-item.generating {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 15px;
    overflow: hidden;
}

.generating-placeholder {
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
}

.generating-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(168, 85, 247, 0.3);
    border-top: 3px solid #a855f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.generating-text {
    color: #fff;
}

.generating-text h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.generating-text p {
    margin: 0;
    color: #9ca3af;
    font-size: 0.85rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: #fff;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(168, 85, 247, 0.3);
    border-top: 3px solid #a855f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h3 {
    margin: 0 0 10px 0;
    font-size: 1.3rem;
}

.loading-content p {
    margin: 0;
    color: #9ca3af;
    font-size: 0.9rem;
}

/* Gallery Loading Placeholder */
.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3/4;
    background: rgba(30, 30, 30, 0.8);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    position: relative;
}

.loading-placeholder .loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid rgba(168, 85, 247, 0.2);
    border-top: 2px solid #a855f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 8px;
}

.loading-placeholder p {
    margin: 0;
    font-size: 0.7rem;
    color: #9ca3af;
    line-height: 1.2;
}

.loading-placeholder p:first-of-type {
    color: #fff;
    font-weight: 500;
    margin-bottom: 2px;
    font-size: 0.75rem;
}

.loading-placeholder .loading-time {
    font-size: 0.6rem;
    color: #6b7280;
    margin-top: 1px;
}

/* Gallery item specific styling for loading */
.gallery-item.loading-placeholder-item {
    background: transparent;
    border: 1px solid rgba(168, 85, 247, 0.2);
}

.gallery-item.loading-placeholder-item .loading-placeholder {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 85, 247, 0.1);
}

/* Error placeholder styles */
.error-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3/4;
    background: rgba(30, 30, 30, 0.8);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    position: relative;
}

.error-placeholder .error-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.error-placeholder p {
    margin: 0;
    font-size: 0.7rem;
    color: #ef4444;
    line-height: 1.2;
}

.error-placeholder p:first-of-type {
    color: #ef4444;
    font-weight: 500;
    margin-bottom: 2px;
    font-size: 0.75rem;
}

.error-placeholder .error-time {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 5px 0;
}

.retry-load-btn {
    background: rgba(168, 85, 247, 0.8);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.retry-load-btn:hover {
    background: rgba(168, 85, 247, 1);
    transform: translateY(-1px);
}

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

/* Gallery item specific styling for errors */
.gallery-item.error-placeholder-item {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.gallery-item.error-placeholder-item .error-placeholder {
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(239, 68, 68, 0.1);
}

/* Mobile responsive adjustments for loading placeholder */
@media (max-width: 768px) {
    .loading-placeholder {
        height: 180px;
        padding: 12px;
    }
    
    .loading-placeholder .loading-spinner {
        width: 24px;
        height: 24px;
        margin-bottom: 6px;
    }
    
    .loading-placeholder p:first-of-type {
        font-size: 0.7rem;
    }
    
    .loading-placeholder p {
        font-size: 0.65rem;
    }
    
    .loading-placeholder .loading-time {
        font-size: 0.55rem;
    }
}

/* My Gallery - Clean Section */
.my-gallery {
    padding: 40px 20px;
    margin: 0 auto;
    max-width: 1400px;
    width: 100%;
}

.my-gallery h2 {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gallery-content {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.no-images {
    color: #6b7280;
    font-size: 1.1rem;
    text-align: center;
    margin: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
}

.gallery-item {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(168, 85, 247, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-item:hover::after {
    opacity: 1;
}

.gallery-item .click-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.gallery-item:hover .click-indicator {
    opacity: 1;
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-info {
    padding: 15px;
}

.gallery-item-info h4 {
    color: #fff;
    font-size: 0.9rem;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.gallery-item-info p {
    color: #9ca3af;
    font-size: 0.8rem;
    margin: 0;
}

/* Selection Modal Styles */
.selection-modal {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
}

.selection-modal .modal-title {
    text-align: center;
    margin-bottom: 30px;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

.selection-item {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    aspect-ratio: 3/4;
    position: relative;
}

.selection-item:hover {
    border-color: rgba(168, 85, 247, 0.6);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(168, 85, 247, 0.2);
}

.selection-item.selected {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.2);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
}

.selection-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 13px;
}

.selection-item .item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    color: white;
    padding: 25px 10px 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    text-transform: capitalize;
}

.selection-item .selected-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #a855f7;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.selection-item.selected .selected-indicator {
    opacity: 1;
}

/* Character Modal Specific Styles */
#characterGrid .selection-item {
    aspect-ratio: 3/4;
}

/* Pose Modal Specific Styles */
#poseGrid .selection-item {
    aspect-ratio: 3/4;
}

/* Modal Overlay Enhancements */
.modal-overlay {
    backdrop-filter: blur(10px);
}

.modal-content {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .generate-media-container {
        padding: 20px 15px;
    }
    
    .generate-media-header h1 {
        font-size: 2rem;
    }
    
    .generate-form {
        padding: 25px;
    }
    
    .my-gallery {
        padding: 25px;
    }
    
    .character-pose-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .character-selection-container,
    .pose-selection-container {
        aspect-ratio: 3/4;
        min-height: 200px;
    }
    
    .selection-modal {
        max-width: 95vw;
        padding: 20px;
    }
    
    .selection-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 15px;
    }
    
    .selection-item .item-name {
        font-size: 0.8rem;
        padding: 20px 8px 8px;
    }
    
    .option-selectors {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .option-buttons {
        gap: 6px;
    }
    
    .option-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .image-count-selector {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .count-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .media-type-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .media-type-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .result-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .result-actions {
        justify-content: center;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        max-width: 100%;
    }
    
    .my-gallery {
        max-width: 100%;
        padding: 30px 15px;
    }
    
    .my-gallery h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
    }
    
    .generate-panel {
        max-width: 100%;
        padding: 25px 15px;
        margin-bottom: 40px;
    }
    
    .gallery-grid {
        max-width: 100%;
    }
}

/* Tablet responsive */
@media (max-width: 1024px) and (min-width: 769px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        max-width: 900px;
    }
    
    .my-gallery {
        max-width: 1000px;
        padding: 35px 20px;
    }
    
    .generate-panel {
        max-width: 700px;
    }
}

/* Legacy styles for compatibility */
.generate-media-section {
    padding: 60px 0;
    background: transparent;
    }
    
.generate-media-section .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    }
    
.generate-panel {
    padding: 30px 20px;
    max-width: 900px;
    margin: 0 auto 60px auto;
}

.generate-header {
    text-align: center;
    margin-bottom: 30px;
}

.generate-title {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.generate-subtitle {
    color: #fbbf24;
    font-size: 1rem;
    font-weight: 500;
}

/* Legacy media type selector */
.generate-media-section .media-type-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.generate-media-section .media-type-btn {
    background: rgba(30, 30, 30, 0.8);
    border: 2px solid rgba(168, 85, 247, 0.3);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.generate-media-section .media-type-btn.active {
    background: linear-gradient(135deg, #a855f7, #ec4899);
    border-color: transparent;
    box-shadow: 0 8px 16px rgba(168, 85, 247, 0.3);
}

.generate-media-section .media-type-btn:hover:not(.active) {
    border-color: rgba(168, 85, 247, 0.6);
    transform: translateY(-1px);
}

/* Legacy form styles */
.generate-media-section .form-group {
    margin-bottom: 20px;
}

.generate-media-section .form-label {
    display: block;
    color: #fff;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.generate-media-section .form-control {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.generate-media-section .form-control:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.generate-media-section .form-control::placeholder {
    color: #6b7280;
}

.generate-media-section .form-control option {
    background: #1f2937;
    color: #fff;
}

/* Image Viewer Styles */
.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    max-height: 100vh;
    padding: 20px;
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10001;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.image-viewer-close:hover {
    background: rgba(168, 85, 247, 0.8);
    transform: scale(1.1);
}

.image-viewer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 20px;
}

.image-viewer-main {
    position: relative;
    max-width: 80%;
    max-height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    transition: opacity 0.15s ease;
    
    /* Ensure 4:3 images don't get too large */
    max-width: min(80vw, calc(80vh * 4/3));
    max-height: min(80vh, calc(80vw * 3/4));
}

.image-viewer-info {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    white-space: nowrap;
    text-align: center;
}

.image-counter {
    display: block;
    margin-bottom: 4px;
}

.navigation-hint {
    font-size: 0.75rem;
    opacity: 0.8;
    color: #ccc;
}

.navigation-hint i {
    margin-right: 4px;
}

.image-viewer-nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.nav-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.8);
    transform: scale(1.1);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

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

/* Mobile optimizations for image viewer */
@media (max-width: 768px) {
    .image-viewer-container {
        padding: 10px;
    }
    
    .image-viewer-close {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .image-viewer-main {
        max-width: 95%;
        max-height: 75%;
    }
    
    .viewer-image {
        border-radius: 8px;
        /* Mobile-specific sizing for 4:3 images */
        max-width: min(95vw, calc(75vh * 4/3));
        max-height: min(75vh, calc(95vw * 3/4));
    }
    
    .image-viewer-nav {
        position: fixed;
        right: 10px;
        gap: 15px;
    }
    
    .nav-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .image-viewer-info {
        bottom: -40px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
    .gallery-item {
        cursor: pointer;
    }
    
    .gallery-item:active {
        transform: scale(0.98);
    }
    
    .nav-btn:active:not(:disabled) {
        background: rgba(168, 85, 247, 0.9);
    }
}

.mobile-hint {
    display: none;
}

/* Show mobile hint on touch devices */
@media (hover: none) and (pointer: coarse) {
    .desktop-hint {
        display: none;
    }
    
    .mobile-hint {
        display: inline;
    }
}