/* Interactive Styles CSS - Glassmorphic Theme for Classicalia - Performance Optimized */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #0066ff 0%, #4d94ff 25%, #e6f0ff 60%, #ffffff 100%);
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    color: #333;
}

/* Floating background shapes - Keep as is */
.bg-shapes {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 102, 255, 0.05);
    animation: float 20s infinite ease-in-out;
}

.shape1 {
    width: 400px;
    height: 400px;
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.shape2 {
    width: 300px;
    height: 300px;
    bottom: -150px;
    left: -150px;
    animation-delay: 5s;
    background: rgba(0, 102, 255, 0.03);
}

.shape3 {
    width: 250px;
    height: 250px;
    top: 50%;
    right: 10%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* GLOBAL INFO BUTTON */
.global-info-btn {
    position: fixed !important;
    top: 2rem !important;
    right: 2rem !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 50% !important;
    width: 48px !important;
    height: 48px !important;
    cursor: pointer !important;
    font-size: 1.25rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 1000 !important;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.1) !important;
    transition: all 0.2s ease !important;
    color: #0066ff !important;
}

.global-info-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.2) !important;
}

/* HEADER */
.header {
    position: relative;
    z-index: 10;
    padding: 3rem 2rem 2rem;
    text-align: center;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff 0%, #e6f0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -3px;
    margin-bottom: 0.5rem;
    text-shadow: 0 10px 40px rgba(0,0,0,0.1);
}

.logo a {
    text-decoration: none;
    background: linear-gradient(135deg, #ffffff 0%, #e6f0ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 300;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.author {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

/* DASHBOARD LAYOUT - 2 Column Grid */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 5;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 2rem;
    align-items: start;
}

/* LEFT SIDEBAR */
.left-sidebar {
    padding-top: 1rem;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.nav-link-sidebar {
    display: block;
    padding: 0.6rem 0;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    padding-left: 0.75rem;
    margin-left: -0.75rem;
}

.nav-link-sidebar:hover {
    color: white;
    border-left-color: white;
}

/* MAIN CONTENT AREA */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* INFO CARD CONTAINER */
.info-card-container {
    position: relative;
    z-index: 5;
    padding: 0 0 1rem 0;
}

/* COLOR LEGEND - Compact version moved to analysis panel */
.color-legend {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
    text-align: center;
}

.legend-title {
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    line-height: 1.3;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1rem;
    font-size: 0.7rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.legend-color.literary-device {
    background-color: rgb(252, 235, 237);
    border-color: rgba(220, 53, 69, 0.3);
}

.legend-color.grammar-point {
    background-color: rgb(225, 243, 252);
    border-color: rgba(0, 123, 255, 0.3);
}

.legend-color.key-vocab {
    background-color: rgb(232, 245, 232);
    border-color: rgba(40, 167, 69, 0.3);
}

.legend-color.character-analysis {
    background-color: rgb(244, 228, 246);
    border-color: rgba(138, 43, 226, 0.3);
}

.legend-color.contrast {
    background-color: rgb(253, 242, 223);
    border-color: rgba(255, 193, 7, 0.4);
}

/* INTERACTIVE CONTAINER LAYOUT */
.interactive-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

/* TEXT PANEL - Optimized blur */
.text-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px); /* Reduced from 10px */
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2rem;
    border-bottom: 2px solid #0066ff;
    padding-bottom: 0.75rem;
}

/* LATIN TEXT STYLING */
.latin-text {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.2rem;
    line-height: 3.5;
    color: #2c3e50;
    margin-bottom: 3rem;
    padding: 3rem 1.5rem 2rem 1.5rem;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 12px;
    border-left: 4px solid #0066ff;
    position: relative;
}

/* WORD CONTAINER */
.word-container {
    display: inline-block;
    margin: 0 3px;                    
    vertical-align: baseline;
    min-height: 1.6em;
    position: relative;
    line-height: 1.6;
}

/* NUMBERS - Performance optimized (NO blur on numbers) */
.number {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(108, 117, 125, 0.15); /* Solid background, no blur */
    border: 1px solid rgba(108, 117, 125, 0.3);
    color: #6c757d;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease; /* Faster transition */
    z-index: 10;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1;
    white-space: nowrap;
    text-align: center;
    pointer-events: auto;
    min-width: 1.2rem;
    max-width: fit-content;
    display: block;
    will-change: transform; /* Optimize for frequent changes */
}

.number:hover {
    background: rgba(108, 117, 125, 0.25);
    border-color: rgba(108, 117, 125, 0.4);
    color: #495057;
    transform: translateX(-50%) scale(1.03); /* Reduced scale */
}

.number.active {
    background: rgba(0, 123, 255, 0.2);
    border-color: rgba(0, 123, 255, 0.4);
    color: #007bff;
    transform: translateX(-50%) scale(1.03);
}

/* Multiple numbers handling */
.word-container .number:first-child {
    left: calc(50% - 12px);
}

.word-container .number:nth-child(2) {
    left: calc(50% + 12px);
}

.word-container .number:nth-child(3) {
    left: 50%;
    top: -35px;
}

/* HIGHLIGHTS */
.highlight {
    cursor: pointer;
    transition: all 0.15s ease; /* Faster transitions */
    border-radius: 3px;
    padding: 0.1em 0.2em;
    margin: 0 0.1em;
    border: 1px solid transparent;
    border-bottom: 2px solid transparent;
    position: relative;
    display: inline;
    line-height: inherit;
    vertical-align: baseline;
    box-sizing: border-box;    
}

.highlight:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08); /* Reduced shadow */
}

.highlight.active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.highlight.literary-device {
    background-color: rgb(252, 235, 237);
    border: 1px solid rgb(220, 53, 69);
    border-bottom: 2px solid rgb(180, 40, 50);
}

.highlight.literary-device:hover,
.highlight.literary-device.active {
    background-color: rgba(252, 235, 237, 0.9);
    border-color: rgb(180, 40, 50);
    border-bottom-color: rgb(140, 30, 40);
}

.highlight.grammar-point {
    background-color: rgb(225, 243, 252);
    border: 1px solid rgb(0, 123, 255);
    border-bottom: 2px solid rgb(0, 100, 200);
}

.highlight.grammar-point:hover,
.highlight.grammar-point.active {
    background-color: rgba(225, 243, 252, 0.9);
    border-color: rgb(0, 100, 200);
    border-bottom-color: rgb(0, 80, 160);
}

.highlight.key-vocab {
    background-color: rgb(232, 245, 232);
    border: 1px solid rgb(40, 167, 69);
    border-bottom: 2px solid rgb(30, 130, 50);
}

.highlight.key-vocab:hover,
.highlight.key-vocab.active {
    background-color: rgba(232, 245, 232, 0.9);
    border-color: rgb(30, 130, 50);
    border-bottom-color: rgb(20, 100, 40);
}

.highlight.character-analysis {
    background-color: rgb(244, 228, 246);
    border: 1px solid rgb(138, 43, 226);
    border-bottom: 2px solid rgb(108, 25, 180);
}

.highlight.character-analysis:hover,
.highlight.character-analysis.active {
    background-color: rgba(244, 228, 246, 0.9);
    border-color: rgb(108, 25, 180);
    border-bottom-color: rgb(85, 15, 140);
}

.highlight.contrast {
    background-color: rgb(253, 242, 223);
    border: 1px solid rgb(255, 193, 7);
    border-bottom: 2px solid rgb(200, 150, 0);
}

.highlight.contrast:hover,
.highlight.contrast.active {
    background-color: rgba(253, 242, 223, 0.9);
    border-color: rgb(200, 150, 0);
    border-bottom-color: rgb(160, 120, 0);
}

.highlight .word-container {
    vertical-align: baseline !important;
    display: inline-block !important;
}

/* ANALYSIS PANEL - Optimized blur */
.analysis-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px); /* Reduced from 10px */
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.6);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.analysis-panel h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 102, 255, 0.2);
    padding-bottom: 0.5rem;
}

.analysis-content {
    display: none;
}

.analysis-content.active {
    display: block;
    animation: fadeIn 0.2s ease; /* Faster animation */
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); } /* Reduced movement */
    to { opacity: 1; transform: translateY(0); }
}

/* VOCABULARY AND ANALYSIS STYLING */
.vocab-word {
    font-size: 1.2rem;
    font-weight: 600;
    color: #0066ff;
    margin-bottom: 0.5rem;
    font-family: 'Georgia', serif;
}

.vocab-meaning {
    font-size: 1.1rem;
    color: #2c3e50;
    padding: 0.75rem;
    background: rgba(248, 249, 250, 0.8);
    border-left: 3px solid #0066ff;
    border-radius: 4px;
    line-height: 1.4;
}

.analysis-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0066ff;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(0, 102, 255, 0.2);
    padding-bottom: 0.5rem;
}

.analysis-word {
    font-size: 1.2rem;
    font-weight: 600;
    color: #0066ff;
    margin-bottom: 0.5rem;
    font-family: 'Georgia', serif;
}

.analysis-content {
    color: #2c3e50;
    line-height: 1.5;
    font-size: 0.95rem;
}

.analysis-translation {
    font-style: italic;
    color: #666;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(248, 249, 250, 0.8);
    border-left: 3px solid #0066ff;
}

.analysis-device {
    margin-bottom: 1rem;
}

.device-name {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analysis-effect {
    background: rgba(231, 243, 255, 0.8);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #0066ff;
}

.effect-title {
    font-weight: 600;
    color: #0066ff;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* PASSAGE ANALYSIS SECTION */
.passage-analysis {
    background: rgba(248, 249, 250, 0.9);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    border-left: 4px solid #0066ff;
}

.passage-analysis h3 {
    font-size: 1.6rem;
    font-weight: 600;
    color: #0066ff;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #0066ff;
    padding-bottom: 0.5rem;
}

.analysis-section {
    margin-bottom: 2rem;
}

.analysis-section:last-child {
    margin-bottom: 0;
}

.analysis-section h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 1rem;
    border-left: 3px solid #0066ff;
    padding-left: 0.75rem;
}

.analysis-section p {
    color: #2c3e50;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.analysis-list {
    list-style: none;
    padding-left: 0;
}

.analysis-list li {
    color: #2c3e50;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.analysis-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #0066ff;
    font-weight: 600;
}

.analysis-list li strong {
    color: #0066ff;
    font-weight: 600;
}

/* TRANSLATION SECTION */
.section-translation {
    background: rgba(248, 249, 250, 0.9);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    cursor: pointer;
    transition: all 0.2s ease; /* Faster transition */
    position: relative;
}

/* TRANSLATION SECTION */
.section-translation {
    background: rgba(248, 249, 250, 0.9);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    cursor: pointer;
    transition: all 0.2s ease; /* Faster transition */
    position: relative;
}

.section-translation.blurred .translation-content {
    filter: blur(3px); /* Reduced blur */
    user-select: none;
}

.section-translation.blurred::before {
    content: "Click to reveal translation";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 102, 255, 0.9);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    z-index: 10;
}

.translation-content {
    transition: filter 0.2s ease; /* Faster transition */
}

.translation-hide-btn {
    display: none;
    text-align: center;
    margin-top: 1rem;
}

.translation-hide-btn button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s ease; /* Faster transition */
}

.translation-hide-btn button:hover {
    background: #545b62;
}

.section-translation:not(.blurred) .translation-hide-btn {
    display: block;
}

/* NAVIGATION */
.navigation {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 2rem;
}

.btn {
    background: linear-gradient(135deg, #0066ff 0%, #4d94ff 100%);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.15s ease; /* Faster transition */
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn:hover {
    background: linear-gradient(135deg, #0056b3 0%, #4080ff 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

/* MODAL STYLES */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 1.5rem 2rem 1rem 2rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
}

.modal-body {
    display: flex;
    gap: 2rem;
    padding: 1rem 2rem;
    align-items: flex-start;
}

.modal-text {
    flex: 2;
}

.modal-text p {
    margin: 0 0 1rem 0;
    line-height: 1.5;
    color: #555;
    font-size: 0.9rem;
}

.modal-text p:last-child {
    margin-bottom: 0;
}

.modal-image {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.modal-image img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e0e0e0;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid #f0f0f0;
    background-color: #fafafa;
    border-radius: 0 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-items {
    display: flex;
    gap: 1rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
    flex: 1;
}

.contact-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

.contact-icon {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 50%;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
}

.contact-label {
    font-weight: 600;
    color: #333;
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.contact-value {
    color: #666;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
}

.modal-signature {
    text-align: center;
    margin-top: 1rem;
}

.modal-signature p {
    margin: 0.25rem 0;
    color: #777;
    font-size: 0.9rem;
}

.modal-signature p:last-child {
    color: #333;
}

.close {
    color: #aaa;
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
    background: none;
    border: none;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close:hover {
    color: #333;
    background-color: #f0f0f0;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .left-sidebar {
        display: flex;
        gap: 3rem;
        padding: 1rem;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        margin-bottom: 1rem;
    }

    .nav-section {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .logo {
        font-size: 3rem;
    }

    .dashboard-container {
        padding: 1rem;
    }

    .interactive-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .text-panel {
        padding: 1.5rem;
    }
    
    .analysis-panel {
        position: relative;
        top: 0;
    }
    
    .legend-items {
        gap: 0.5rem 1rem;
    }
    
    .navigation {
        flex-direction: column;
    }
    
    .global-info-btn {
        top: 1rem !important;
        right: 1rem !important;
        width: 40px !important;
        height: 40px !important;
    }

    .left-sidebar {
        flex-direction: column;
        gap: 1rem;
    }

    .number {
        padding: 0.1rem 0.3rem;
        font-size: 0.65rem;
        min-width: 1rem;
    }
}
