/**
 * D&D AI RPG - Dialogue System Styles
 * Branching conversation UI with skill checks and choices
 */

/* ============================================================================
   DIALOGUE OVERLAY
   ============================================================================ */

.dialogue-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dialogue-overlay.hidden {
    display: none;
}

.dialogue-container {
    width: 100%;
    max-width: 900px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    border: 3px solid #3498db;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* ============================================================================
   DIALOGUE HEADER
   ============================================================================ */

.dialogue-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    padding: 20px 25px;
    display: flex;
    gap: 15px;
    align-items: center;
    border-bottom: 2px solid #2471a3;
    position: relative;
}

.npc-portrait {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2), rgba(0,0,0,0.3));
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portrait-icon {
    font-size: 40px;
}

.npc-info {
    flex: 1;
}

.npc-name {
    color: white;
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.npc-title {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 8px;
}

.relationship-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 12px;
    border-radius: 12px;
    width: fit-content;
}

.rel-icon {
    font-size: 16px;
}

.rel-value {
    color: white;
    font-size: 13px;
    font-weight: bold;
}

.rel-value.rel-adored { color: #ff69b4; }
.rel-value.rel-friendly { color: #2ecc71; }
.rel-value.rel-liked { color: #58d68d; }
.rel-value.rel-neutral { color: #95a5a6; }
.rel-value.rel-disliked { color: #f5b041; }
.rel-value.rel-hostile { color: #e67e22; }
.rel-value.rel-hated { color: #e74c3c; }

.dialogue-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

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

/* ============================================================================
   DIALOGUE CONTENT
   ============================================================================ */

.dialogue-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 25px;
    gap: 20px;
}

/* ============================================================================
   DIALOGUE TEXT AREA
   ============================================================================ */

.dialogue-text-area {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    min-height: 150px;
}

.npc-dialogue {
    margin-bottom: 15px;
}

.dialogue-bubble {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.2), rgba(41, 128, 185, 0.1));
    border: 2px solid #3498db;
    border-radius: 12px;
    padding: 20px;
    color: white;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    animation: dialogueFadeIn 0.5s;
}

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

/* ============================================================================
   SKILL CHECK RESULT
   ============================================================================ */

.skill-check-result {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
    border: 2px solid #95a5a6;
    animation: checkFadeIn 0.3s;
}

@keyframes checkFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.skill-check-result.success {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
}

.skill-check-result.failure {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.check-type {
    color: #3498db;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.check-roll {
    color: white;
    font-size: 16px;
    margin-bottom: 5px;
    font-family: monospace;
}

.check-dc {
    color: #95a5a6;
    font-size: 13px;
    margin-bottom: 8px;
}

.check-outcome {
    font-size: 18px;
    font-weight: bold;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.skill-check-result.success .check-outcome {
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.2);
}

.skill-check-result.failure .check-outcome {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.2);
}

/* ============================================================================
   DIALOGUE HISTORY
   ============================================================================ */

.dialogue-history {
    margin-top: 20px;
}

.history-toggle-btn {
    background: rgba(52, 152, 219, 0.2);
    border: 2px solid #3498db;
    color: #3498db;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    font-weight: bold;
    width: 100%;
}

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

.history-content {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 15px;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.history-content.hidden {
    display: none;
}

.history-entry {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.history-entry:last-child {
    margin-bottom: 0;
}

.history-entry.npc {
    background: rgba(52, 152, 219, 0.1);
    border-left: 3px solid #3498db;
}

.history-entry.player {
    background: rgba(46, 204, 113, 0.1);
    border-left: 3px solid #2ecc71;
}

.history-speaker {
    color: #95a5a6;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.history-text {
    color: #ecf0f1;
    font-size: 13px;
    line-height: 1.4;
}

/* ============================================================================
   DIALOGUE CHOICES
   ============================================================================ */

.dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dialogue-choice-btn {
    background: linear-gradient(135deg, rgba(52, 73, 94, 0.6), rgba(44, 62, 80, 0.6));
    border: 3px solid #34495e;
    border-radius: 10px;
    padding: 15px 20px;
    color: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.dialogue-choice-btn:hover:not(:disabled) {
    border-color: #3498db;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.3), rgba(41, 128, 185, 0.2));
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.3);
}

.dialogue-choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dialogue-choice-btn.has-skill-check {
    border-color: #f39c12;
}

.dialogue-choice-btn.has-skill-check:hover:not(:disabled) {
    border-color: #f5b041;
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.3), rgba(230, 126, 34, 0.2));
}

.choice-text {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.choice-check {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(243, 156, 18, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    width: fit-content;
    margin-top: 8px;
}

.check-icon {
    font-size: 14px;
}

.check-label {
    color: #f39c12;
    font-size: 12px;
    font-weight: bold;
}

.choice-alignment {
    background: rgba(155, 89, 182, 0.2);
    color: #9b59b6;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
    margin-top: 8px;
}

.choice-relationship {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
    margin-top: 8px;
}

/* ============================================================================
   DIALOGUE FOOTER
   ============================================================================ */

.dialogue-footer {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px 25px;
    border-top: 2px solid #34495e;
}

.dialogue-footer.hidden {
    display: none;
}

.skill-check-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #f39c12;
    font-size: 14px;
    font-weight: bold;
}

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

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

    .dialogue-header {
        padding: 15px;
    }

    .npc-portrait {
        width: 60px;
        height: 60px;
    }

    .portrait-icon {
        font-size: 30px;
    }

    .npc-name {
        font-size: 18px;
    }

    .npc-title {
        font-size: 12px;
    }

    .dialogue-content {
        padding: 15px;
    }

    .dialogue-bubble {
        font-size: 14px;
        padding: 15px;
    }

    .choice-text {
        font-size: 14px;
    }

    .dialogue-choice-btn {
        padding: 12px 15px;
    }
}

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

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

.dialogue-choice-btn {
    animation: slideInFromBottom 0.3s ease-out;
}

.dialogue-choice-btn:nth-child(1) { animation-delay: 0.1s; }
.dialogue-choice-btn:nth-child(2) { animation-delay: 0.2s; }
.dialogue-choice-btn:nth-child(3) { animation-delay: 0.3s; }
.dialogue-choice-btn:nth-child(4) { animation-delay: 0.4s; }
.dialogue-choice-btn:nth-child(5) { animation-delay: 0.5s; }

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

.dialogue-choice-btn:focus {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

.dialogue-container:focus-within {
    box-shadow: 0 20px 60px rgba(52, 152, 219, 0.4);
}
