/**
 * Profile Modal Styles
 * Floating avatar button and modal overlay
 */

/* Floating Profile Button */
.profile-modal-button {
    position: fixed;
    top: 90px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--button-color, #0066cc);
    color: white;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.profile-modal-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.profile-modal-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Bouncing Ball Animation */
.profile-modal-button.bobbing {
    animation: bouncing-ball 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes bouncing-ball {
    0% {
        transform: translateY(-200px) scale(1);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    15% {
        transform: translateY(0px) scaleY(0.9) scaleX(1.1);
        animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    17% {
        transform: translateY(0px) scale(1);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    25% {
        transform: translateY(-50px) scale(1);
        animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    35% {
        transform: translateY(0px) scaleY(0.95) scaleX(1.05);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    37% {
        transform: translateY(0px) scale(1);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    42% {
        transform: translateY(-25px) scale(1);
        animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    50% {
        transform: translateY(0px) scaleY(0.97) scaleX(1.03);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    52% {
        transform: translateY(0px) scale(1);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    56% {
        transform: translateY(-12px) scale(1);
        animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    62% {
        transform: translateY(0px) scaleY(0.98) scaleX(1.02);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    64% {
        transform: translateY(0px) scale(1);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    67% {
        transform: translateY(-6px) scale(1);
        animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    72% {
        transform: translateY(0px) scaleY(0.99) scaleX(1.01);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    74% {
        transform: translateY(0px) scale(1);
        animation-timing-function: cubic-bezier(0.55, 0.05, 0.68, 0.19);
    }
    76% {
        transform: translateY(-3px) scale(1);
        animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    80% {
        transform: translateY(0px) scaleY(0.995) scaleX(1.005);
    }
    82% {
        transform: translateY(0px) scale(1);
    }
    100% {
        transform: translateY(0px) scale(1);
    }
}

/* Button Icon */
.profile-modal-button svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

/* Button Avatar Image (if used) */
.profile-modal-button .button-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Modal Overlay */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.profile-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.profile-modal {
    background: var(--color-bg);
    background-image: var(--mountains-bg);
    background-repeat: no-repeat;
    background-position: bottom center;
    background-size: cover;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    border: 1px solid var(--color-border);
    position: relative;
}

.profile-modal-overlay.visible .profile-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.profile-modal-header {
    padding: 20px 20px 0 20px;
    display: flex;
    justify-content: flex-end;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 12px 12px 0 0;
    position: relative;
    z-index: 1;
}

.profile-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text);
    opacity: 0.7;
    transition: opacity 0.2s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.profile-modal-close:hover {
    opacity: 1;
    background: var(--color-border);
}

/* Modal Content */
.profile-modal-content {
    padding: 0 20px 60px 20px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.5) 70%, rgba(255, 255, 255, 0.15) 100%);
    margin: 0;
    border-radius: 0 0 12px 12px;
    position: relative;
    z-index: 1;
}

.profile-modal-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top: 4px solid var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

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

/* Modal Body */
.profile-modal-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

/* Profile Section */
.profile-section {
    padding-right: 1rem;
}

.profile-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--color-border);
}

.avatar-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--blue-pastel);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--color-text);
    border: 3px solid var(--color-border);
}

.profile-text {
    flex: 1;
}

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

.profile-tagline {
    font-size: 1rem;
    color: #666;
    margin: 0 0 1rem 0;
    font-style: italic;
}

.profile-bio {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-text);
}

.profile-bio p {
    margin: 0 0 1rem 0;
}

.profile-bio p:last-child {
    margin-bottom: 0;
}

/* Navigation Section */
.navigation-section {
    padding-left: 1rem;
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Tag Cloud Section */
.tag-cloud-section {
    flex: 1;
}

.tag-cloud-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    color: var(--color-text);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: baseline;
}

.tag-cloud-item {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--green-pastel);
    color: var(--color-text);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--pill-border);
}

.tag-cloud-item:hover {
    background: var(--green-pastel-hover, #c8e6c9);
    transform: translateY(-1px);
}

/* About Section */
.about-section {
    margin-top: auto;
}

/* About Content View */
.about-content {
    padding: 1rem;
}

.back-button {
    background: none;
    border: none;
    color: var(--color-accent);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
}

.back-button:hover {
    color: var(--color-text);
}

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

.about-text {
    line-height: 1.6;
    color: var(--color-text);
    max-width: none;
}

.about-text h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: var(--color-text);
}

.about-text p {
    margin: 0 0 1rem 0;
}

.about-text ul, .about-text ol {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.about-text li {
    margin-bottom: 0.5rem;
}

.about-text strong {
    font-weight: 600;
}

.about-text a {
    color: var(--color-accent);
    text-decoration: none;
}

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

.about-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--color-text);
    background: var(--yellow-pastel);
    border: 1px solid var(--pill-border);
    transition: all 0.2s ease;
}

.about-link:hover {
    background: var(--yellow-pastel-hover, #fff3c4);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Mobile Styles */
@media (max-width: 800px) {
    .profile-modal-button {
        width: 40px;
        height: 40px;
        top: 100px;
        right: 15px;
    }

    .profile-modal-button svg {
        width: 18px;
        height: 18px;
    }

    .profile-modal {
        margin: 10px;
        max-height: 95vh;
    }

    .profile-modal-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .profile-section {
        padding-right: 0;
    }

    .navigation-section {
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--color-border);
        padding-top: 1.5rem;
    }

    .profile-info {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .profile-avatar {
        align-self: center;
    }
}

/* Accessibility */
.profile-modal-overlay:focus-within .profile-modal {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* Body class when modal is open */
body.profile-modal-open {
    overflow: hidden;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .profile-modal {
        border: 2px solid var(--color-text);
    }

    .quick-link, .about-link {
        border: 2px solid var(--color-text);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .profile-modal-button.bobbing {
        animation: none;
    }

    .profile-modal-overlay, .profile-modal,
    .profile-modal-button, .quick-link, .about-link {
        transition: none;
    }
}