/* ============================================================================
   GUARDIAN HOUSE STYLE 3.0 - LEGENDARY EDITION
   ============================================================================
   Revolutionary visual system for Book Writer Studio
   Version: 3.0 | January 2026
   Innovation: 3D Immersive Book Experience
   ============================================================================ */

/* --------------------------------------------------------------------------
   3D BOOK RENDERING SYSTEM
   -------------------------------------------------------------------------- */
.book-3d-container {
    perspective: 2000px;
    perspective-origin: 50% 50%;
    width: 100%;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.book-3d-legendary {
    position: relative;
    width: 320px;
    height: 420px;
    transform-style: preserve-3d;
    transform: rotateY(-25deg) rotateX(5deg);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.book-3d-legendary:hover {
    transform: rotateY(-5deg) rotateX(2deg) scale(1.05);
}

.book-3d-legendary.open {
    transform: rotateY(0deg) rotateX(0deg);
}

.book-cover-front {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #0a0e27 100%);
    border-radius: 0 8px 8px 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        inset 0 0 60px rgba(0, 255, 200, 0.1),
        0 0 30px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 200, 0.3);
    overflow: hidden;
}

.book-3d-legendary.open .book-cover-front {
    transform: rotateY(-160deg);
}

.book-cover-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(135deg, transparent 40%, rgba(0, 255, 200, 0.1) 50%, transparent 60%),
        linear-gradient(45deg, transparent 40%, rgba(201, 166, 65, 0.1) 50%, transparent 60%);
    animation: coverShimmer 4s ease-in-out infinite;
}

@keyframes coverShimmer {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.book-cover-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 2;
}

.book-title-3d {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(135deg, #00ffc8 0%, #c9a641 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 10px;
}

.book-author-3d {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.book-genre-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid rgba(139, 92, 246, 0.5);
    border-radius: 20px;
    font-size: 0.75rem;
    color: #c4b5fd;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: fit-content;
}

.book-spine-3d {
    position: absolute;
    left: -30px;
    top: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, #0a0814 0%, #1a1a2e 100%);
    transform: rotateY(90deg);
    transform-origin: right center;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-weight: 700;
    font-size: 0.9rem;
    color: #c9a641;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-left: 2px solid rgba(201, 166, 65, 0.5);
}

.book-back-3d {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0814 0%, #151520 100%);
    transform: translateZ(-30px);
    border-radius: 8px 0 0 8px;
    border: 1px solid rgba(0, 255, 200, 0.2);
}

.book-pages-3d {
    position: absolute;
    right: 0;
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    top: 5px;
    background: repeating-linear-gradient(
        90deg,
        #f5f5dc 0px,
        #f5f5dc 2px,
        #e8e8c8 2px,
        #e8e8c8 4px
    );
    transform: translateZ(-15px);
    border-radius: 0 4px 4px 0;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.book-page-inner {
    position: absolute;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    top: 10px;
    left: 10px;
    background: #fdfdf5;
    border-radius: 4px;
    transform: translateZ(-14px);
    padding: 30px;
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    line-height: 1.8;
    color: #333;
    overflow: hidden;
}

.book-page-inner::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent, #ddd 20%, #ddd 80%, transparent);
}

.page-text-preview {
    opacity: 0.8;
    max-height: 100%;
    overflow: hidden;
}

.book-shadow-3d {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%) rotateX(90deg);
    width: 90%;
    height: 40px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.4) 0%, transparent 70%);
    filter: blur(10px);
}

/* Page turn animation */
@keyframes pageTurn {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(-90deg); }
    100% { transform: rotateY(-180deg); }
}

.page-turning {
    animation: pageTurn 1.2s ease-in-out;
}

/* --------------------------------------------------------------------------
   STORY DNA VISUALIZER
   -------------------------------------------------------------------------- */
.story-dna-container {
    background: rgba(10, 14, 39, 0.9);
    border-radius: 20px;
    padding: 30px;
    border: 1px solid rgba(0, 255, 200, 0.2);
    position: relative;
    overflow: hidden;
}

.story-dna-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    animation: dnaRotate 20s linear infinite;
}

@keyframes dnaRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.dna-strand {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.dna-node {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.dna-node.theme {
    background: linear-gradient(135deg, rgba(0, 255, 200, 0.2) 0%, rgba(0, 255, 200, 0.05) 100%);
    border: 2px solid rgba(0, 255, 200, 0.4);
}

.dna-node.character {
    background: linear-gradient(135deg, rgba(201, 166, 65, 0.2) 0%, rgba(201, 166, 65, 0.05) 100%);
    border: 2px solid rgba(201, 166, 65, 0.4);
}

.dna-node.conflict {
    background: linear-gradient(135deg, rgba(255, 0, 85, 0.2) 0%, rgba(255, 0, 85, 0.05) 100%);
    border: 2px solid rgba(255, 0, 85, 0.4);
}

.dna-node.setting {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(139, 92, 246, 0.05) 100%);
    border: 2px solid rgba(139, 92, 246, 0.4);
}

.dna-node:hover {
    transform: scale(1.15);
    box-shadow: 0 0 30px currentColor;
}

.dna-node i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.dna-node span {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Connection lines between nodes */
.dna-connector {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, rgba(0, 255, 200, 0.5), rgba(201, 166, 65, 0.5));
    transform-origin: left center;
    animation: pulseConnector 2s ease-in-out infinite;
}

@keyframes pulseConnector {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* --------------------------------------------------------------------------
   CHAPTER JOURNEY FLOW
   -------------------------------------------------------------------------- */
.chapter-journey {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 30px 0;
    overflow-x: auto;
    position: relative;
}

.chapter-journey::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        rgba(0, 255, 200, 0.3), 
        rgba(201, 166, 65, 0.3), 
        rgba(139, 92, 246, 0.3),
        rgba(0, 255, 200, 0.3));
    transform: translateY(-50%);
    z-index: 0;
}

.journey-node {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.journey-node:hover {
    transform: translateY(-10px);
}

.journey-marker {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e 0%, #0a0e27 100%);
    border: 3px solid rgba(0, 255, 200, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #00ffc8;
    transition: all 0.3s ease;
    position: relative;
}

.journey-marker::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px dashed rgba(0, 255, 200, 0.3);
    animation: markerSpin 10s linear infinite;
}

@keyframes markerSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.journey-node.active .journey-marker {
    background: linear-gradient(135deg, #00ffc8 0%, #00d4aa 100%);
    color: #0a0e27;
    box-shadow: 0 0 30px rgba(0, 255, 200, 0.5);
}

.journey-node.completed .journey-marker {
    background: linear-gradient(135deg, #c9a641 0%, #e0b850 100%);
    border-color: #c9a641;
    color: #0a0e27;
}

.journey-label {
    margin-top: 15px;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 100px;
}

.journey-word-count {
    font-size: 0.7rem;
    color: rgba(0, 255, 200, 0.7);
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   AI WRITING COMPANION PANEL
   -------------------------------------------------------------------------- */
.ai-companion-panel {
    background: linear-gradient(180deg, rgba(10, 14, 39, 0.95) 0%, rgba(26, 26, 46, 0.95) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.ai-companion-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #8b5cf6, #00ffc8, #c9a641, #8b5cf6);
    background-size: 300% 100%;
    animation: aiPanelGradient 4s linear infinite;
}

@keyframes aiPanelGradient {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 0%; }
}

.companion-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: avatarFloat 3s ease-in-out infinite;
}

@keyframes avatarFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.ai-suggestion-card {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 15px;
    margin: 10px 0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-suggestion-card:hover {
    background: rgba(139, 92, 246, 0.2);
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.2);
}

.suggestion-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #c4b5fd;
    margin-bottom: 8px;
}

.suggestion-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   BOOK PAGE WRITING MODE
   -------------------------------------------------------------------------- */
.book-page-editor {
    background: #fdfdf5;
    min-height: 600px;
    border-radius: 0 12px 12px 0;
    padding: 60px 80px;
    position: relative;
    box-shadow: 
        -5px 0 20px rgba(0, 0, 0, 0.1),
        inset 0 0 100px rgba(0, 0, 0, 0.02);
    overflow: hidden;
}

.book-page-editor::before {
    content: '';
    position: absolute;
    left: 50px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #ffc0cb;
    opacity: 0.5;
}

.book-page-editor::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 50px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.05), transparent);
}

.page-lines {
    background-image: repeating-linear-gradient(
        transparent,
        transparent 31px,
        #e0e0e0 31px,
        #e0e0e0 32px
    );
    min-height: 100%;
}

.book-page-textarea {
    width: 100%;
    min-height: 500px;
    background: transparent;
    border: none;
    outline: none;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.1rem;
    line-height: 32px;
    color: #2a2a2a;
    resize: none;
    padding: 0;
}

.book-page-textarea::placeholder {
    color: #999;
    font-style: italic;
}

.page-number {
    position: absolute;
    bottom: 30px;
    right: 40px;
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    color: #666;
}

/* Book spine shadow effect */
.page-spine-shadow {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(90deg, 
        rgba(0, 0, 0, 0.15) 0%, 
        rgba(0, 0, 0, 0.05) 50%, 
        transparent 100%);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   LEGENDARY MODAL STYLES (3.0)
   -------------------------------------------------------------------------- */
.modal-legendary {
    --modal-bg: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 50%, #0a0e27 100%);
}

.modal-legendary .modal-content {
    background: var(--modal-bg);
    border: 1px solid rgba(0, 255, 200, 0.3);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 
        0 25px 100px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(0, 255, 200, 0.1),
        0 0 120px rgba(139, 92, 246, 0.05);
}

.modal-legendary .modal-header {
    background: linear-gradient(135deg, rgba(0, 255, 200, 0.1) 0%, rgba(201, 166, 65, 0.1) 100%);
    border-bottom: 1px solid rgba(0, 255, 200, 0.2);
    padding: 25px 30px;
    position: relative;
}

.modal-legendary .modal-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #00ffc8, #c9a641, transparent);
}

.modal-legendary .modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-legendary .modal-footer {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(0, 255, 200, 0.1);
    padding: 20px 30px;
}

/* Modal entrance animation */
.modal-legendary.show .modal-dialog {
    animation: modalLegendaryEntrance 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* --------------------------------------------------------------------------
   WRITING METRICS DASHBOARD
   -------------------------------------------------------------------------- */
.metrics-orb {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 255, 200, 0.1) 0%, rgba(0, 255, 200, 0.05) 100%);
    border: 2px solid rgba(0, 255, 200, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.metrics-orb::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 1px dashed rgba(0, 255, 200, 0.2);
    animation: orbSpin 15s linear infinite;
}

@keyframes orbSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.metrics-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00ffc8, #c9a641);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metrics-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

/* --------------------------------------------------------------------------
   RESPONSIVE ADJUSTMENTS
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
    .book-3d-container {
        height: 400px;
    }
    
    .book-3d-legendary {
        width: 260px;
        height: 340px;
    }
    
    .book-page-editor {
        padding: 40px 50px;
    }
    
    .chapter-journey {
        padding: 20px 10px;
    }
}

@media (max-width: 768px) {
    .book-3d-container {
        height: 350px;
        perspective: 1500px;
    }
    
    .book-3d-legendary {
        width: 220px;
        height: 290px;
        transform: rotateY(-15deg) rotateX(3deg);
    }
    
    .book-page-editor {
        padding: 30px;
    }
    
    .book-page-textarea {
        font-size: 1rem;
        line-height: 28px;
    }
}
