/**
 * D&D AI RPG - Quest Journal System Styles
 * Narrative novel-style quest tracking with beautiful presentation
 */

/* ============================================================================
   JOURNAL PANEL
   ============================================================================ */

.journal-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #9b59b6;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.journal-panel.hidden {
    display: none;
}

/* ============================================================================
   JOURNAL HEADER
   ============================================================================ */

.journal-header {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #7d3c98;
}

.journal-header h2 {
    color: white;
    margin: 0;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-family: 'Georgia', serif;
}

.close-journal-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.close-journal-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ============================================================================
   JOURNAL TABS
   ============================================================================ */

.journal-tabs {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px 20px;
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #34495e;
    overflow-x: auto;
}

.journal-tab-btn {
    background: rgba(155, 89, 182, 0.2);
    border: 2px solid #9b59b6;
    color: #9b59b6;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.journal-tab-btn:hover {
    background: rgba(155, 89, 182, 0.3);
    border-color: #bb8fce;
    transform: translateY(-2px);
}

.journal-tab-btn.active {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
    border-color: #bb8fce;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

.tab-icon {
    font-size: 18px;
}

/* ============================================================================
   JOURNAL CONTENT
   ============================================================================ */

.journal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
}

.journal-tab-content {
    display: none;
}

.journal-tab-content.active {
    display: block;
}

.no-content {
    text-align: center;
    color: #95a5a6;
    font-size: 16px;
    font-style: italic;
    padding: 60px 20px;
}

/* ============================================================================
   STORY TAB
   ============================================================================ */

.chapter-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin-bottom: 20px;
}

.chapter-nav-btn {
    background: rgba(52, 152, 219, 0.3);
    border: 2px solid #3498db;
    color: white;
    font-size: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chapter-nav-btn:hover:not(:disabled) {
    background: rgba(52, 152, 219, 0.5);
    border-color: #5dade2;
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.chapter-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.chapter-title {
    font-size: 28px;
    font-weight: bold;
    color: #f39c12;
    font-family: 'Georgia', serif;
}

.story-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 30px;
    min-height: 400px;
}

.chapter-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(243, 156, 18, 0.3);
}

.chapter-header h3 {
    color: #f39c12;
    margin: 0 0 10px 0;
    font-size: 32px;
    font-family: 'Georgia', serif;
}

.chapter-subtitle {
    color: #95a5a6;
    font-size: 18px;
    font-style: italic;
}

.chapter-entries {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.story-entry {
    background: rgba(0, 0, 0, 0.3);
    border-left: 4px solid #3498db;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
}

.story-entry:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: translateX(5px);
}

.scene-number {
    color: #3498db;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.story-image {
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.story-image img {
    width: 100%;
    height: auto;
    display: block;
}

.story-text {
    color: #ecf0f1;
    font-size: 16px;
    line-height: 1.8;
    font-family: 'Georgia', serif;
}

.story-timestamp {
    color: #7f8c8d;
    font-size: 12px;
    margin-top: 15px;
    text-align: right;
    font-style: italic;
}

/* ============================================================================
   QUESTS TAB
   ============================================================================ */

.quest-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    background: rgba(52, 152, 219, 0.2);
    border: 2px solid #3498db;
    color: #3498db;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}

.filter-btn:hover {
    background: rgba(52, 152, 219, 0.3);
    border-color: #5dade2;
}

.filter-btn.active {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border-color: #5dade2;
}

.quest-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.quest-card {
    background: linear-gradient(135deg, rgba(52, 73, 94, 0.6), rgba(44, 62, 80, 0.6));
    border: 3px solid #34495e;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
}

.quest-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    border-color: #5dade2;
}

.quest-card.completed {
    border-color: #27ae60;
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.2), rgba(46, 204, 113, 0.1));
}

.quest-card.failed {
    border-color: #e74c3c;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(192, 57, 43, 0.1));
}

.quest-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.quest-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.quest-title-section {
    flex: 1;
}

.quest-title {
    color: #f39c12;
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: bold;
}

.quest-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quest-type {
    background: rgba(52, 152, 219, 0.3);
    color: #3498db;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.quest-difficulty {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.quest-difficulty.easy { background: #27ae60; color: white; }
.quest-difficulty.medium { background: #f39c12; color: white; }
.quest-difficulty.hard { background: #e67e22; color: white; }
.quest-difficulty.deadly { background: #e74c3c; color: white; }

.quest-status-badge {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.quest-status-badge.completed {
    background: #27ae60;
    color: white;
}

.quest-status-badge.failed {
    background: #e74c3c;
    color: white;
}

.quest-description {
    color: #ecf0f1;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.quest-objectives {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.quest-objectives h5 {
    color: #3498db;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.quest-objectives ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quest-objectives li {
    color: #bdc3c7;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.quest-objectives li:last-child {
    border-bottom: none;
}

.quest-objectives li.completed {
    color: #2ecc71;
    text-decoration: line-through;
}

.quest-rewards {
    background: rgba(243, 156, 18, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid #f39c12;
    margin-bottom: 15px;
}

.quest-rewards h5 {
    color: #f39c12;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.reward-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.reward-item {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.quest-giver {
    color: #95a5a6;
    font-size: 12px;
    font-style: italic;
}

/* ============================================================================
   CHOICES TAB
   ============================================================================ */

.choices-timeline {
    position: relative;
    padding-left: 40px;
}

.choices-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #3498db, #9b59b6);
}

.choice-entry {
    position: relative;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border-left: 4px solid #3498db;
    transition: all 0.3s;
}

.choice-entry:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: translateX(5px);
}

.choice-entry.major {
    border-left-color: #f39c12;
}

.choice-entry.critical {
    border-left-color: #e74c3c;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.3);
}

.choice-marker {
    position: absolute;
    left: -28px;
    top: 20px;
    width: 12px;
    height: 12px;
    background: #3498db;
    border: 3px solid #1a1a2e;
    border-radius: 50%;
}

.choice-entry.major .choice-marker {
    background: #f39c12;
}

.choice-entry.critical .choice-marker {
    background: #e74c3c;
    animation: criticalPulse 2s infinite;
}

@keyframes criticalPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(231, 76, 60, 0.5); }
    50% { box-shadow: 0 0 20px rgba(231, 76, 60, 1); }
}

.choice-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.choice-title {
    color: #f39c12;
    font-size: 18px;
    font-weight: bold;
}

.choice-timestamp {
    color: #7f8c8d;
    font-size: 12px;
    font-style: italic;
}

.choice-situation {
    color: #bdc3c7;
    font-size: 14px;
    line-height: 1.6;
    font-style: italic;
}

.choice-made {
    background: rgba(52, 152, 219, 0.2);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #3498db;
}

.choice-label {
    color: #3498db;
    font-weight: bold;
    font-size: 13px;
    text-transform: uppercase;
}

.choice-text {
    color: white;
    font-size: 15px;
    font-weight: bold;
}

.choice-alternatives {
    background: rgba(149, 165, 166, 0.1);
    padding: 12px;
    border-radius: 8px;
}

.alternatives-label {
    color: #95a5a6;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.choice-alternatives ul {
    list-style: none;
    padding-left: 15px;
    margin: 8px 0 0 0;
}

.choice-alternatives li {
    color: #95a5a6;
    font-size: 13px;
    padding: 4px 0;
}

.choice-alternatives li::before {
    content: '→ ';
    color: #7f8c8d;
}

.choice-consequences {
    background: rgba(243, 156, 18, 0.1);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #f39c12;
}

.consequences-label {
    color: #f39c12;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.choice-consequences p {
    color: #ecf0f1;
    font-size: 14px;
    margin: 8px 0 0 0;
}

.choice-impact {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    width: fit-content;
}

.choice-impact.minor { background: #95a5a6; color: white; }
.choice-impact.moderate { background: #3498db; color: white; }
.choice-impact.major { background: #f39c12; color: white; }
.choice-impact.critical { background: #e74c3c; color: white; }

/* ============================================================================
   DEVELOPMENT TAB
   ============================================================================ */

.development-timeline {
    position: relative;
    padding-left: 40px;
}

.development-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #2ecc71, #27ae60);
}

.development-entry {
    position: relative;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border-left: 4px solid #2ecc71;
    transition: all 0.3s;
}

.development-entry:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: translateX(5px);
}

.dev-marker {
    position: absolute;
    left: -28px;
    top: 15px;
    width: 12px;
    height: 12px;
    background: #2ecc71;
    border: 3px solid #1a1a2e;
    border-radius: 50%;
}

.dev-marker.level { background: #f39c12; }
.dev-marker.skill { background: #3498db; }
.dev-marker.achievement { background: #9b59b6; }
.dev-marker.relationship { background: #e74c3c; }

.dev-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dev-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.dev-icon {
    font-size: 24px;
}

.dev-title {
    color: #2ecc71;
    font-size: 16px;
    font-weight: bold;
    flex: 1;
}

.dev-timestamp {
    color: #7f8c8d;
    font-size: 11px;
    font-style: italic;
}

.dev-description {
    color: #ecf0f1;
    font-size: 14px;
    line-height: 1.6;
}

.dev-changes {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-change {
    background: rgba(46, 204, 113, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.stat-name {
    color: #95a5a6;
    font-size: 12px;
    font-weight: bold;
}

.stat-value {
    font-size: 14px;
    font-weight: bold;
}

.stat-value.positive {
    color: #2ecc71;
}

.stat-value.negative {
    color: #e74c3c;
}

/* ============================================================================
   EXPORT TAB
   ============================================================================ */

.export-options {
    max-width: 800px;
    margin: 0 auto;
}

.export-options h3 {
    color: #f39c12;
    margin: 0 0 10px 0;
    font-size: 24px;
}

.export-options > p {
    color: #95a5a6;
    margin-bottom: 30px;
}

.export-format-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.export-format-selector label {
    background: rgba(52, 152, 219, 0.2);
    border: 2px solid #3498db;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.export-format-selector label:hover {
    background: rgba(52, 152, 219, 0.3);
    border-color: #5dade2;
    transform: translateY(-2px);
}

.export-format-selector input[type="radio"]:checked + span {
    font-weight: bold;
}

.export-format-selector label:has(input:checked) {
    background: rgba(52, 152, 219, 0.4);
    border-color: #5dade2;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.export-format-selector input[type="radio"] {
    accent-color: #3498db;
}

.export-format-selector span {
    color: white;
    font-size: 14px;
}

.export-settings {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.export-settings label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    color: #ecf0f1;
    font-size: 14px;
    cursor: pointer;
}

.export-settings input[type="checkbox"] {
    accent-color: #2ecc71;
    width: 18px;
    height: 18px;
}

.export-btn {
    background: linear-gradient(135deg, #27ae60, #229954);
    border: none;
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    width: 100%;
    margin-bottom: 30px;
}

.export-btn:hover {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.export-icon {
    font-size: 20px;
}

.export-preview {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #34495e;
    border-radius: 10px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.export-preview h4 {
    color: #3498db;
    margin: 0 0 15px 0;
    font-size: 16px;
}

.export-preview-content {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 8px;
    color: #ecf0f1;
    font-size: 13px;
    line-height: 1.6;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 1024px) {
    .journal-panel {
        width: 95%;
        height: 90vh;
    }

    .journal-header h2 {
        font-size: 20px;
    }

    .journal-tabs {
        overflow-x: auto;
    }

    .choices-timeline,
    .development-timeline {
        padding-left: 30px;
    }
}

@media (max-width: 768px) {
    .journal-panel {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .journal-header {
        padding: 15px 20px;
    }

    .journal-content {
        padding: 15px;
    }

    .chapter-title {
        font-size: 20px;
    }

    .quest-header {
        flex-direction: column;
    }

    .choice-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .export-format-selector {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

.journal-panel:focus-within {
    outline: 3px solid #9b59b6;
    outline-offset: -3px;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

.story-entry,
.quest-card,
.choice-entry,
.development-entry {
    animation: fadeIn 0.3s ease-out;
}
