/**
 * AI Photo Trend - Components
 * Reusable UI components (modals, loading, dropdown, etc.)
 */

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
}

.cosmic-loader {
    width: 150px;
    height: 150px;
    position: relative;
    margin: 0 auto 2rem;
}

.loader-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

.loader-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: var(--accent-red);
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.loader-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top-color: var(--accent-purple);
    animation-duration: 1s;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.loading-text {
    color: var(--text-secondary);
}

/* ===== BASIC MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.9);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.theme-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ===== IMAGE MODAL (OLD STYLE) ===== */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
}

.modal-content-large {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 10;
    box-shadow: 0 10px 50px rgba(179, 0, 255, 0.3);
}

.modal-images-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 2rem;
    align-items: center;
    margin-top: 1rem;
}

.modal-image-box {
    text-align: center;
}

.modal-image-box h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--accent-purple);
}

.modal-image-box img {
    width: 100%;
    height: auto;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.modal-arrow {
    font-size: 3rem;
    color: var(--accent-purple);
    font-weight: bold;
}

/* ===== PROFILE DROPDOWN ===== */
.nav-profile-dropdown {
    position: relative;
}

.nav-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(42, 42, 63, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
}

.nav-profile-btn:hover {
    background: rgba(42, 42, 63, 0.8);
    border-color: var(--accent-purple);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-red));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.profile-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    min-width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.nav-profile-dropdown.active .profile-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.875rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:first-child {
    border-radius: 15px 15px 0 0;
}

.dropdown-item:last-child {
    border-bottom: none;
    border-radius: 0 0 15px 15px;
}

.dropdown-item:hover,
.dropdown-item.active {
    background: rgba(179, 0, 255, 0.1);
    color: var(--accent-purple);
}

/* ===== PROFILE MODALS ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(179, 0, 255, 0.3);
}

.modal-box.modal-danger {
    border-color: var(--error);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

.modal-header h3 {
    font-size: 1.1rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s ease;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 0, 68, 0.1);
    color: var(--error);
}

.modal-body {
    padding: 1.5rem;
}

.modal-form {
    padding: 1.5rem;
}

.modal-form .form-group {
    margin-bottom: 1rem;
}

.modal-form .form-group:last-child {
    margin-bottom: 0;
}

.modal-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.modal-form .form-input {
    width: 100%;
    padding: 0.7rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.modal-form .form-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(179, 0, 255, 0.1);
}

.modal-form .form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Password Input in Modals */
.modal-form .password-input-wrapper {
    position: relative;
}

.modal-form .password-input {
    padding-right: 3rem;
}

.modal-form .password-toggle {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 3rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-form .password-toggle:hover {
    color: var(--accent-purple);
}

.modal-form .password-toggle:active {
    transform: scale(0.95);
}

.modal-form .eye-icon {
    flex-shrink: 0;
}

.danger-text {
    color: var(--error);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.danger-list {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
}

.danger-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.danger-list li:before {
    content: "⚠";
    position: absolute;
    left: 0;
    color: var(--error);
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* ===== COMPACT GALLERY MODAL ===== */
.modal-gallery-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.25rem;
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    position: relative;
    box-shadow: 0 10px 50px rgba(179, 0, 255, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-title-compact {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    text-align: center;
    color: var(--accent-purple);
    font-weight: 600;
}

.modal-images-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.25rem;
    align-items: center;
    max-width: 100%;
}

.modal-image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.modal-image-item h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
}

.modal-image-item img {
    max-width: 40vw;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.modal-arrow-compact {
    font-size: 1.5rem;
    color: var(--accent-purple);
    font-weight: bold;
}

/* Tablet - iPad için modal optimize */
@media (min-width: 769px) and (max-width: 1024px) {
    .modal-gallery-content {
        padding: 1.5rem;
        max-width: 85vw;
        max-height: 90vh;
    }
    
    .modal-images-grid {
        gap: 1.5rem;
        max-width: 100%;
    }
    
    .modal-image-item img {
        max-width: 35vw;
        max-height: 60vh;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    
    .modal-arrow-compact {
        font-size: 1.2rem;
    }
    
    .modal-title-compact {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    .modal-image-item h4 {
        font-size: 0.9rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .modal-images-container {
        grid-template-columns: 1fr auto 1fr;
        gap: 0.5rem;
    }
    
    .modal-arrow {
        font-size: 1.5rem;
    }
    
    /* Modal - Yan yana görünüm (mobilde de) */
    .modal-images-grid {
        grid-template-columns: 1fr auto 1fr;
        gap: 0.5rem;
        width: 100%;
    }
    
    .modal-arrow-compact {
        font-size: 1rem;
    }
    
    .modal-image-item img {
        max-width: 42vw;
        max-height: 50vh;
        width: auto;
        height: auto;
        object-fit: contain;
    }
    
    .modal-gallery-content {
        padding: 0.75rem;
        max-height: 85vh;
        width: 95vw;
        max-width: 95vw;
    }
    
    .modal-title-compact {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .modal-image-item h4 {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .modal-images-grid {
        gap: 0.35rem;
    }
    
    .modal-arrow-compact {
        font-size: 0.9rem;
    }
    
    .modal-image-item img {
        max-width: 40vw;
        max-height: 45vh;
        width: auto;
        height: auto;
        object-fit: contain;
        border-radius: 8px;
    }
    
    .modal-gallery-content {
        padding: 0.6rem;
    }
    
    .modal-title-compact {
        font-size: 0.8rem;
    }
    
    .modal-image-item h4 {
        font-size: 0.65rem;
    }
    
    .modal-close {
        width: 28px;
        height: 28px;
        font-size: 1rem;
        top: 0.4rem;
        right: 0.4rem;
    }
}

/* ===== AI THEME CARD STYLES ===== */
/* Main styles are now in themes.css - this file only contains legacy/fallback styles */

/* Legacy tag style (for backwards compatibility) */
.ai-theme-card__tag {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-red));
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(179, 0, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

