.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    height: 64px;
    padding: 0 24px;
}

.nav-left {
    position: absolute;
    left: 24px;
}

.nav-right {
    position: absolute;
    right: 24px;
}

.nav-left h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.app-title {
    cursor: pointer;
    transition: transform 0.2s ease;
    user-select: none;
}

.app-title:hover {
    transform: scale(1.03);
}

.sign-in-button {
    background-color: transparent;
    border: 1px solid #2196F3;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    color: #2196F3;
    font-size: 18px;
}

.sign-in-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.container {
    margin-top: 80px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
}

#imagesContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.image-wrapper:hover {
    transform: scale(1.05);
}

.image-wrapper img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    max-height: 400px;
    cursor: pointer;
}

.image-wrapper p {
    position: absolute;
    bottom: 10px;
    left: 10px;
    margin: 0;
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 5px;
    font-size: 14px;
}

.download-icon {
    display: none;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 80%;
    max-height: 80vh;
    object-fit: contain;
    transition: opacity 0.2s ease-in-out;
}

.modal-content.changing {
    opacity: 0.5;
}

.modal-prompt {
    color: white;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    margin-top: 15px;
    max-width: 600px;
    text-align: center;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.close {
    position: fixed;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

.pro-overlay {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: rgba(255, 0, 0, 0.7);
  color: white;
  padding: 5px;
  border-radius: 3px;
  font-size: 14px;
  z-index: 10;
}

#loading {
    border: 8px solid rgba(0, 0, 0, 0.1);
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001; /* Ensure it appears above other elements */
}

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

.auth-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.auth-button:hover {
    opacity: 0.9;
}

.auth-button.google {
    background-color: #fff;
    color: #757575;
    border: 1px solid #ddd;
}

.auth-button.github {
    color: #24292e;
}

.auth-button i {
    font-size: 20px;
}

#userInfo {
    text-align: center;
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

.auth-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.auth-modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close-auth {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.auth-modal h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 24px;
    color: #333;
}

.auth-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-button {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    transition: background-color 0.2s;
}

.auth-button img {
    width: 24px;
    height: 24px;
    margin-right: 12px;
}

.auth-button.google {
    color: #333;
}

.auth-button.x {
  color: #333;
}

.auth-button.email {
    color: #333;
}

.auth-button:hover {
    background-color: #f5f5f5;
}

.terms-text {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin: 24px 0;
}

.terms-text a {
    color: #333;
    text-decoration: none;
}

.terms-text a:hover {
    text-decoration: underline;
}

.additional-links {
    display: none;
}

.legal-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
}

.legal-content h1 {
    color: #333;
    margin-bottom: 30px;
}

.legal-content h2 {
    color: #444;
    margin-top: 30px;
    margin-bottom: 15px;
}

.legal-content p {
    margin-bottom: 20px;
    color: #666;
}

.user-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-button {
    background-color: transparent;
    border: 1px solid #2196F3;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    color: #2196F3;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-button:hover {
    background-color: rgba(33, 150, 243, 0.1);
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #fff;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 8px;
    z-index: 1000;
    margin-top: 8px;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: #f5f5f5;
}

.dropdown-content.show {
    display: block;
}

.dropdown-divider {
    height: 1px;
    margin: 5px 0;
    overflow: hidden;
    background-color: #e9ecef;
    border: none;
}

.credits-display {
    padding: 8px 16px;
    color: #666;
    cursor: default;  /* Quita el cursor pointer */
    background: #f5f5f5;  /* Fondo sutil para distinguirlo */
    border-radius: 4px;
    margin: 4px 8px;
}

.text-muted {
    color: #888;
}

.prompt-form {
    margin-bottom: 20px;
    width: 100%;
}

.input-wrapper {
    position: relative;
    width: 100%;
    background: white;
    border-radius: 15px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.input-wrapper textarea {
    width: 100%;
    min-height: 50px;
    padding: 12px;
    padding-right: 45px;
    border: none;
    border-radius: 10px;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.4;
    outline: none;
    background: #f5f5f5;
    box-sizing: border-box;
}

/* Sobrescribir estilos de Pico CSS */
.input-wrapper button[type="submit"] {
    position: absolute !important;
    bottom: 90px !important;
    right: 20px !important;
    background: #2196F3 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.2s !important;
    font-size: inherit !important;
    line-height: 1 !important;
}

.input-wrapper button[type="submit"]:hover {
    background: #1976D2 !important;
}

.input-wrapper button[type="submit"] i {
    font-size: 18px;
}

.button-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #eee;
    }

    .top-nav {
        background-color: #1e1e1e;
        border-bottom: 1px solid #333;
    }

    .nav-left h1, .nav-right, .dropdown-button, .dropdown-content a {
        color: #eee;
    }
    
    .sign-in-button, .dropdown-button {
        border: 1px solid #bb86fc;
        color: #bb86fc;
    }

    .sign-in-button:hover, .dropdown-button:hover {
        background-color: rgba(187, 134, 252, 0.1);
    }

    .container, .auth-modal-content {
        background-color: #1e1e1e;
    }

    .input-wrapper {
        background: #1e1e1e;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    }

    .input-wrapper textarea {
        background: #2c2c2c;
        color: #e0e0e0;
    }

    .input-wrapper button[type="submit"] {
        background: #bb86fc !important;
    }

    .input-wrapper button[type="submit"]:hover {
        background: #9b59b6 !important;
    }

    .modal {
        background-color: rgba(0, 0, 0, 0.9);
    }

    .close, .close-auth {
        color: #e0e0e0;
    }

    .close:hover, .close:focus, .close-auth:hover, .close-auth:focus {
        color: #bbb;
    }

    .terms-text a {
        color: #bb86fc;
    }

    .terms-text a:hover {
        text-decoration: underline;
    }

    .dropdown-content {
        background-color: #2c2c2c;
    }

    .dropdown-content a:hover {
        background-color: #3c3c3c;
    }

    .credits-display {
        background: #2c2c2c;
        color: #e0e0e0;
    }

    .text-muted {
        color: #888;
    }

    .modal-prompt {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .modal-model {
        color: #ccc;
    }

    .dropdown-divider {
        background-color: #444;
    }
}

/* Smart selection toggle styles - compatible with Pico CSS */
.smart-select-option {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.smart-select-option label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    color: var(--pico-muted-color, #666);
}

.smart-select-option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 1px solid var(--pico-form-element-border-color, #ccc);
    border-radius: 0.25rem;
    background-color: var(--pico-form-element-background-color, #fff);
    display: grid;
    place-content: center;
    margin: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.smart-select-option input[type="checkbox"]::before {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    transform: scale(0);
    transition: transform 0.2s ease;
    box-shadow: inset 1rem 1rem var(--pico-primary-color, #2196F3);
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.smart-select-option input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.smart-select-option input[type="checkbox"]:focus {
    outline: 2px solid var(--pico-primary-focus, rgba(33, 150, 243, 0.25));
    outline-offset: 2px;
}

.smart-select-option input[type="checkbox"]:hover {
    border-color: var(--pico-primary-hover, #1976D2);
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .smart-select-option label {
        color: var(--pico-muted-color, #aaa);
    }
    
    .smart-select-option input[type="checkbox"] {
        background-color: var(--pico-form-element-background-color, #2c2c2c);
        border-color: var(--pico-form-element-border-color, #444);
    }
    
    .smart-select-option input[type="checkbox"]::before {
        box-shadow: inset 1rem 1rem var(--pico-primary-color, #bb86fc);
    }
    
    .smart-select-option input[type="checkbox"]:hover {
        border-color: var(--pico-primary-hover, #9b59b6);
    }
}

.modal-nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 24px;
    font-weight: bold;
    padding: 15px 20px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    transition: background-color 0.3s ease;
    user-select: none;
}

.modal-nav-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-prev-button {
    left: 20px;
}

.modal-next-button {
    right: 20px;
}

@media (prefers-color-scheme: dark) {
    .modal-nav-button {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    .modal-nav-button:hover {
        background-color: rgba(255, 255, 255, 0.4);
    }
}

@media (max-width: 768px) {
    .modal-nav-button {
        display: none; /* Ocultar botones de navegación en dispositivos móviles */
    }
    
    .modal-prev-button {
        left: 10px;
    }
    
    .modal-next-button {
        right: 10px;
    }
}

/* Modal info container */
.modal-info {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 10px;
}

/* Modal model name style */
.modal-model {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
    margin-bottom: 10px;
}

/* Options menu button (three dots) */
.options-menu-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-wrapper:hover .options-menu-button {
    opacity: 1;
}

/* Options dropdown menu */
.options-dropdown {
    position: absolute;
    top: 45px;
    right: 10px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 20;
    display: none;
    min-width: 150px;
}

.options-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.options-dropdown a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.options-dropdown a:hover {
    background-color: #f5f5f5;
}

.options-dropdown a i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

/* Dark mode styles for options menu */
@media (prefers-color-scheme: dark) {
    .options-menu-button {
        background-color: rgba(255, 255, 255, 0.2);
        color: #eee;
    }
    
    .options-dropdown {
        background-color: #333;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    }
    
    .options-dropdown a {
        color: #eee;
    }
    
    .options-dropdown a:hover {
        background-color: #444;
    }
}

/* Video modal specific styles */
.video-modal {
    z-index: 1001; /* Ensure video modal appears above image modal */
}

.video-content {
    max-width: 90%;
    max-height: 80vh;
    margin: auto;
    display: block;
    object-fit: contain;
}

@media (prefers-color-scheme: dark) {
    /* Dark mode styles */
}

/* Loading message styles */
.loading-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
    margin: 10px 0;
}

/* Success message styles */
.success-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
    margin: 10px 0;
}

/* Error message styles */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background-color: rgba(244, 67, 54, 0.1);
    border-radius: 4px;
    margin: 10px 0;
}

/* Spinner for loading */
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #4CAF50;
    animation: spin 1s ease-in-out infinite;
}

/* Disabled option style */
.options-dropdown a.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

@media (prefers-color-scheme: dark) {
    .loading-message {
        background-color: rgba(76, 175, 80, 0.2);
    }
    
    .success-message {
        background-color: rgba(76, 175, 80, 0.2);
    }
    
    .error-message {
        background-color: rgba(244, 67, 54, 0.2);
    }
    
    .spinner {
        border-color: rgba(255, 255, 255, 0.1);
        border-top-color: #4CAF50;
    }
}

/* Video loading overlay */
.video-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1002;
    color: white;
    border-radius: 4px;
}

.video-loading-overlay .spinner {
    width: 40px;
    height: 40px;
    border-width: 4px;
    margin-bottom: 15px;
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: white;
}

.video-loading-overlay p {
    font-size: 1rem;
    margin: 0;
}

/* Image loading overlay */
.image-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    color: white;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
}

.image-loading-overlay .spinner {
    width: 30px;
    height: 30px;
    border-width: 3px;
    margin-bottom: 10px;
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: white;
}

.image-loading-overlay p {
    font-size: 0.9rem;
    margin: 0;
    padding: 0 10px;
}
