/* Estilos para la página de perfil */

.perfil-page {
    background: #f8f9fa;
}

/* Loading State */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Auth Required Section */
.auth-required-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.auth-required-content {
    text-align: center;
    max-width: 400px;
}

.auth-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    color: white;
    font-size: 32px;
}

.auth-required-content h2 {
    margin: 0 0 16px;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
}

.auth-required-content p {
    margin: 0 0 32px;
    color: #666;
    line-height: 1.5;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-btn.secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.auth-btn.secondary:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Profile Header */
.profile-header-section {
    background: white;
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    position: relative;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    flex-shrink: 0;
}

.profile-info-main h1 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
}

.profile-info-main p {
    margin: 0 0 12px;
    color: #666;
    font-size: 16px;
}

.profile-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.edit-profile-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.edit-profile-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Profile Stats */
.profile-stats-section {
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 20px;
    color: #007bff;
}

.stat-info h3 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
}

.stat-info p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Profile Options */
.profile-options-section {
    margin-bottom: 100px;
}

.options-grid {
    display: grid;
    gap: 12px;
}

.option-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
}

.option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.option-card.danger:hover {
    background: #fef2f2;
    border-color: #fecaca;
}

.option-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #007bff;
    flex-shrink: 0;
}

.option-card.danger .option-icon {
    color: #dc3545;
}

.option-card h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.option-card p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.option-card > i:last-child {
    margin-left: auto;
    color: #ccc;
    font-size: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .edit-profile-btn {
        position: static;
        align-self: center;
    }
    
    .profile-header-section {
        padding: 24px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .stat-info h3 {
        font-size: 20px;
    }
    
    .option-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .auth-buttons {
        width: 100%;
    }
    
    .profile-info-main h1 {
        font-size: 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .stat-card {
        display: flex;
        align-items: center;
        text-align: left;
        gap: 16px;
        padding: 16px;
    }
    
    .stat-icon {
        margin: 0;
    }
}

/* Liked Photos Modal */
.liked-photos-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.liked-photos-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.liked-photos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.liked-photos-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
}

.close-liked-photos-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-liked-photos-modal:hover {
    background: #e9ecef;
    color: #333;
}

.liked-photos-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.liked-photos-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #666;
}

.liked-photos-loading .loading-spinner {
    margin-bottom: 16px;
}

.liked-photos-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.empty-state {
    text-align: center;
    color: #666;
}

.empty-state i {
    font-size: 4rem;
    color: #ddd;
    margin-bottom: 16px;
}

.empty-state h3 {
    margin: 0 0 8px 0;
    color: #333;
}

.empty-state p {
    margin: 0;
    font-size: 0.9rem;
}

.liked-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.liked-photo-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.liked-photo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.liked-photo-image {
    aspect-ratio: 1;
    width: 100%;
    object-fit: cover;
    display: block;
}

.photo-placeholder {
    aspect-ratio: 1;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #666;
}

.photo-placeholder i {
    font-size: 2rem;
    margin-bottom: 8px;
    color: #ddd;
}

.photo-placeholder p {
    margin: 0;
    font-size: 0.8rem;
}

.photo-actions {
    padding: 6px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.download-photo-btn,
.unlike-photo-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #666;
    border: 1px solid #dee2e6;
    min-width: 32px;
    height: 32px;
    flex: 0 0 auto;
}

.download-photo-btn i,
.unlike-photo-btn i {
    font-size: 1rem;
}

.download-photo-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: translateY(-1px);
}

.unlike-photo-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    transform: translateY(-1px);
}

.download-photo-btn:active,
.unlike-photo-btn:active {
    transform: translateY(0);
}

/* Lightbox para Fotos Favoritas */
.favorites-lightbox {
    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;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-counter {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10001;
}

.lightbox-gallery-name {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 13px;
    font-weight: 400;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 14px;
    border-radius: 16px;
    z-index: 10001;
    max-width: 80%;
    text-align: center;
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-gallery-name:not(:empty) {
    opacity: 1;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-image-container {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-loading-spinner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-loading-spinner.active {
    opacity: 1;
}

.spinner-ring {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.lightbox-loading-spinner span {
    color: white;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

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

#favoritesLightboxImage {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    transition: opacity 0.4s ease, filter 0.4s ease;
    will-change: filter, opacity;
}

.liked-photo-image {
    transition: opacity 0.3s ease;
}

.liked-photo-image[src] {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Ocultar flechas en móvil */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .lightbox-counter {
        top: 10px;
        font-size: 14px;
        padding: 6px 12px;
    }
    
    .lightbox-gallery-name {
        bottom: 10px;
        font-size: 12px;
        padding: 5px 12px;
        max-width: 90%;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .liked-photos-modal {
        padding: 10px;
    }
    
    .liked-photos-content {
        max-height: 95vh;
    }
    
    .liked-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    
    .liked-photos-header {
        padding: 16px 20px;
    }
    
    .liked-photos-body {
        padding: 20px;
    }
    
    /* Asegurar que los botones estén en línea en mobile */
    .photo-actions {
        flex-direction: row !important;
        gap: 8px;
        padding: 8px;
    }
    
    .download-photo-btn,
    .unlike-photo-btn {
        min-width: 40px;
        height: 40px;
        padding: 8px;
        flex: 0 0 auto;
    }
    
    .download-photo-btn i,
    .unlike-photo-btn i {
        font-size: 1.2rem;
    }
}

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

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

/* Modal de edición de perfil */
.edit-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.edit-profile-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease-out;
}

.edit-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 0;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 24px;
}

.edit-profile-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
}

.close-edit-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.close-edit-modal:hover {
    background: #f5f5f5;
    color: #333;
}

/* New Styles for Profile Picture and Description */

.profile-avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.profile-avatar-large {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.profile-avatar-large-initial {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    flex-shrink: 0;
}

.profile-user-description {
    margin: 4px 0 12px;
    color: #555;
    font-size: 15px;
    line-height: 1.5;
}

/* Edit Modal Styles */
.profile-picture-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

.profile-picture-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 3px solid #f0f0f0;
    margin-bottom: 12px;
}

#previewImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.change-picture-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.change-picture-btn:hover {
    background-color: #e0e0e0;
}

.change-picture-btn i {
    font-size: 16px;
}

#editDescription {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    resize: vertical;
    min-height: 80px;
}
