/* Poem Annotations Styles - Genius-like Design */

/* Highlighted annotated text in poem - Genius style */
.annotated-text {
    background-color: rgba(255, 235, 59, 0.35);
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    padding: 2px 4px;
    margin: 0 -4px;
    border-radius: 3px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.annotated-text:hover {
    background-color: rgba(255, 235, 59, 0.55);
    box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.3);
}


/* Annotation Button (appears on text selection) */
.annotation-button {
    position: absolute;
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    transition: all 0.2s;
}

.annotation-button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(29, 155, 240, 0.3);
}

.annotation-button svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Annotation Modal (for adding new annotations) */
.annotation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

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

.annotation-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.annotation-modal-content {
    position: relative;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.3s ease-out;
}

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

.annotation-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.annotation-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.annotation-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.annotation-modal-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.annotation-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 100px);
}

.selected-text-preview {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-left: 3px solid var(--primary-color);
    border-radius: 0.5rem;
}

.selected-text-preview strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.selected-text-content {
    margin: 0;
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.6;
}

.annotation-login-message {
    text-align: center;
    padding: 2rem;
}

.annotation-login-message p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.btn-login {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.annotation-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: border-color 0.2s;
}

.annotation-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.1);
}

.annotation-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.btn-cancel,
.btn-save {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

.btn-cancel {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-cancel:hover {
    background-color: var(--bg-hover);
}

.btn-save {
    background: var(--primary-color);
    color: white;
}

.btn-save:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Annotations Panel (Genius-style sidebar) */
.annotations-panel {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background-color: var(--card-bg);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 1500;
    transition: right 0.3s ease-out;
    overflow-y: auto;
}

.annotations-panel.show {
    right: 0;
}

.annotations-panel-content {
    padding: 1.5rem;
}

.annotations-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.annotations-selected-text {
    flex: 1;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.6;
    color: var(--text-primary);
    font-style: italic;
    padding-right: 1rem;
}

.annotations-panel-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.annotations-panel-close:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.annotations-panel-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.annotation-panel-item {
    padding: 1rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.annotation-panel-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border-light);
}

.annotation-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.annotation-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

/* New styles for profile photo links and images */
.user-avatar-link {
    display: block;
    border-radius: 9999px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.user-avatar-link:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(255, 235, 59, 0.3);
}

.user-avatar-image {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.user-name-link {
    text-decoration: none;
    transition: color 0.2s;
}

.user-name-link:hover .user-name {
    color: var(--primary-color);
    text-decoration: underline;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.annotation-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.annotation-delete {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.annotation-delete:hover {
    background-color: rgba(244, 33, 46, 0.1);
    color: rgb(244, 33, 46);
}

.annotation-delete svg {
    width: 1rem;
    height: 1rem;
}

.annotation-content {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Toast notification */
.annotation-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-md);
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.3s ease-out;
}

.annotation-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .annotations-panel {
        width: 100%;
        right: -100%;
    }

    .annotations-panel.show {
        right: 0;
    }

    .annotation-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .annotation-modal-header,
    .annotation-modal-body {
        padding: 1rem;
    }

    .annotation-modal-actions {
        flex-direction: column;
    }

    .btn-cancel,
    .btn-save {
        width: 100%;
    }

    .annotation-toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}

/* Dark mode specific adjustments */
[data-theme="dark"] .annotation-modal-overlay {
    background-color: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .annotated-text {
    background-color: rgba(255, 235, 59, 0.25);
}

[data-theme="dark"] .annotated-text:hover {
    background-color: rgba(255, 235, 59, 0.40);
    box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.2);
}

/* Tutorial Modal Styles */
.annotation-tutorial-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.annotation-tutorial-modal.show {
    opacity: 1;
}

.annotation-tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.annotation-tutorial-content {
    position: relative;
    background-color: var(--card-bg);
    border-radius: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUpBounce 0.5s ease-out;
}

@keyframes slideUpBounce {
    0% {
        transform: translateY(100px) scale(0.95);
        opacity: 0;
    }
    60% {
        transform: translateY(-10px) scale(1.02);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.annotation-tutorial-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 2rem;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
}

.annotation-tutorial-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.annotation-tutorial-body {
    padding: 3rem 2rem 2rem;
    min-height: 400px;
    position: relative;
}

.tutorial-step {
    display: none;
    text-align: center;
    animation: fadeInSlide 0.4s ease-out;
}

.tutorial-step.active {
    display: block;
}

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

.tutorial-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, #FFEB3B 0%, #FFC107 100%);
    border-radius: 50%;
    color: #000;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 235, 59, 0.7);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(255, 235, 59, 0);
    }
}

.tutorial-step h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tutorial-step p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

.tutorial-step strong {
    color: var(--text-primary);
    font-weight: 600;
}

.tutorial-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
}

.tutorial-prev,
.tutorial-next {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.tutorial-prev:hover:not(:disabled),
.tutorial-next:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 155, 240, 0.3);
}

.tutorial-prev:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.tutorial-dots {
    display: flex;
    gap: 0.75rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
}

.dot:hover {
    background: var(--text-secondary);
    transform: scale(1.2);
}

.dot.active {
    background: linear-gradient(135deg, #FFEB3B 0%, #FFC107 100%);
    width: 32px;
    border-radius: 6px;
}

/* Annotation Stats */
#annotation-stats {
    animation: fadeIn 0.5s ease-out;
}

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

#toggle-annotations-list {
    transition: all 0.2s;
}

#toggle-annotations-list:hover {
    color: var(--primary-color);
}

#annotation-list-arrow {
    transition: transform 0.3s ease;
}

/* Annotations List Container */
#annotations-list-container {
    animation: slideDown 0.3s ease-out;
}

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