@import url('../_root.css');

.identityModalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;
    backdrop-filter: blur(5px);
}

.identityModalOverlay.active {
    opacity: 1;
    visibility: visible;
}

.identityModal {
    background: var(--background);
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.identityModalOverlay.active .identityModal {
    opacity: 1;
    transform: translateY(0);
}

.identityModalContent {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.identityModalHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: var(--background);
    border-bottom: 1px solid rgba(248, 249, 250, 0.1);
    flex-shrink: 0;
}

.identityModalTitle {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.identityModalCloseButton {
    background: none;
    border: none;
    color: rgba(248, 249, 250, 0.7);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s ease;
    border-radius: 4px;
}

.identityModalCloseButton:hover {
    color: var(--accent-color);
    background: rgba(248, 249, 250, 0.1);
}

.identityModalBody {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    min-height: 0;
    max-height: calc(90vh - 160px);
}

.identityModalFooter {
    padding: 1.5rem 2rem;
    background: var(--background);
    border-top: 1px solid rgba(248, 249, 250, 0.1);
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.identityModalButton {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.identityModalButtonSecondary {
    background: rgba(248, 249, 250, 0.1);
    color: var(--text-color);
}

.identityModalButtonSecondary:hover {
    background: rgba(248, 249, 250, 0.2);
}

/* Custom Scrollbar Styling */
.identityModalBody::-webkit-scrollbar {
    width: 8px;
}

.identityModalBody::-webkit-scrollbar-track {
    background: rgba(248, 249, 250, 0.05);
    border-radius: 4px;
}

.identityModalBody::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

.identityModalBody {
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) rgba(248, 249, 250, 0.05);
}

.identityModalHeaderContent {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(248, 249, 250, 0.1);
}

.identityModalAvatar {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--tertiary-color);
}

.identityModalAvatarImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.identityModalAvatarFallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
}

.identityModalBasicInfo {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.identityModalNickname,
.identityModalOccupation,
.identityModalDate {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.identityModalLifespan {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.identityModalLabel {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.95rem;
    min-width: 160px;
    flex-shrink: 0;
    opacity: 0.9;
}

.identityModalValue {
    color: var(--text-color);
    font-size: 1rem;
    flex-shrink: 1;
    flex-grow: 0;
    min-width: 0;
    word-break: break-word;
}

.identityModalNickname .identityModalValue {
    font-style: italic;
    color: var(--secondary-color);
}

.identityModalOccupation .identityModalValue {
    font-weight: 500;
}

.identityModalDate .identityModalValue {
    font-family: monospace;
    background: rgba(93, 123, 154, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    border-left: 3px solid var(--secondary-color);
}

.identityModalSection {
    margin-bottom: 2rem;
    text-align: left;
}

.identityModalSection:last-child {
    margin-bottom: 0;
}

.identityModalSectionTitle {
    color: var(--text-color);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(248, 249, 250, 0.1);
    padding-bottom: 0.5rem;
}

.identityModalSectionContent {
    color: rgba(248, 249, 250, 0.9);
    line-height: 1.6;
}

.identityModalBiography {
    margin: 0;
    text-align: justify;
}

.identityModalAssociatedImages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.identityModalAssociatedImageLink {
    display: block;
    text-decoration: none;
    position: relative;
}

.identityModalAssociatedImage {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1;
    background: rgba(57, 60, 72, 0.5);
    transition: transform 0.2s ease;
}

.identityModalAssociatedImage:hover {
    transform: scale(1.05);
}

.identityModalImageThumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.identityModalImageOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.identityModalAssociatedImage:hover .identityModalImageOverlay {
    opacity: 1;
}

.identityModalImageOverlay i {
    color: white;
    font-size: 1.25rem;
}

.identityModalHistoricalContext {
    margin: 0;
    text-align: justify;
    color: rgba(248, 249, 250, 0.8);
    font-style: italic;
}

.identityModalLoadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.identityModalLoadingSpinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: identityModalSpin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

.identityModalLoadingOverlay p {
    color: white;
    font-size: 1rem;
}

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

.loadingAssociatedImages {
    text-align: center;
    padding: 2rem;
}

.loadingAssociatedImages .loadingSpinner {
    width: 30px;
    height: 30px;
    border: 2px solid rgba(var(--text-color-rgb, 248, 249, 250), 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: identityModalSpin 1s ease-in-out infinite;
    margin: 0 auto 1rem auto;
}

.loadingAssociatedImages p {
    color: rgba(var(--text-color-rgb, 248, 249, 250), 0.7);
}

.errorLoadingImages,
.errorMessage {
    text-align: center;
    padding: 2rem;
    color: #ff6b6b;
}

.errorMessage i {
    font-size: 3rem;
    color: #ff6b6b;
    margin-bottom: 1rem;
}

.errorMessage h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.errorMessage p {
    color: rgba(var(--text-color-rgb, 248, 249, 250), 0.7);
}

.noAssociatedImages {
    color: rgba(var(--text-color-rgb, 248, 249, 250), 0.6);
    text-align: center;
    padding: 1rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .identityModalHeaderContent {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .identityModalBasicInfo {
        text-align: center;
        align-items: center;
    }

    .identityModalNickname,
    .identityModalOccupation,
    .identityModalDate {
        justify-content: center;
        text-align: center;
        flex-direction: column;
        gap: 0.25rem;
    }

    .identityModalLabel {
        min-width: auto;
        font-size: 0.85rem;
    }

    .identityModalValue {
        font-size: 0.95rem;
    }

    .identityModalLifespan {
        justify-content: center;
    }

    .identityModal {
        width: 95%;
        max-height: 85vh;
    }

    .identityModalAssociatedImages {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
}

@media (max-width: 480px) {
    .identityModalHeader,
    .identityModalBody,
    .identityModalFooter {
        padding: 1rem;
    }

    .identityModalTitle {
        font-size: 1.25rem;
    }

    .identityModalAvatar {
        width: 100px;
        height: 100px;
    }

    .identityModalBody::-webkit-scrollbar {
        width: 4px;
    }
}
