/* css/conversation.css - Enhanced Conversation Modal Styles */

/* Conversation Modal Styles */
.conversation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.conversation-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.conversation-header {
    padding: 25px;
    background: linear-gradient(135deg, #4a90e2, #1e40af);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.conv-character-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.character-avatar-small {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.character-avatar-small.has-image {
    background: rgba(255, 255, 255, 0.1);
}

.character-avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.character-name {
    font-size: 1.4em;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.close-conversation {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-conversation:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.conversation-log {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    max-height: 350px;
    min-height: 250px;
    background: linear-gradient(to bottom, #fafafa, #f5f5f5);
    display: flex;
    flex-direction: column;
}

.conversation-start {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-bottom: 25px;
    padding: 15px;
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-radius: 15px;
    border-left: 4px solid #4a90e2;
    font-weight: 500;
}

.conversation-entry {
    margin-bottom: 20px;
    animation: messageSlideIn 0.4s ease-out;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

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

.conversation-entry.player {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.conversation-entry.character {
    justify-content: flex-start;
    flex-direction: row;
}

/* Character portrait in conversation */
.conversation-portrait {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4a90e2, #1e40af);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2em;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    border: 3px solid rgba(74, 144, 226, 0.3);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.conversation-portrait.has-image {
    background: transparent;
    padding: 0;
}

.conversation-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
}

/* Player portrait styling */
.conversation-entry.player .conversation-portrait {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: rgba(16, 185, 129, 0.3);
}

/* Character portrait with reaction styling */
.conversation-portrait.reaction-love {
    border-color: #e91e63;
    box-shadow: 0 6px 25px rgba(233, 30, 99, 0.4);
    animation: reactionPulse 0.6s ease-out;
}

.conversation-portrait.reaction-happy {
    border-color: #4caf50;
    box-shadow: 0 6px 25px rgba(76, 175, 80, 0.4);
    animation: reactionPulse 0.6s ease-out;
}

.conversation-portrait.reaction-neutral {
    border-color: #9e9e9e;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.conversation-portrait.reaction-sad {
    border-color: #ff9800;
    box-shadow: 0 6px 25px rgba(255, 152, 0, 0.4);
}

.conversation-portrait.reaction-angry {
    border-color: #f44336;
    box-shadow: 0 6px 25px rgba(244, 67, 54, 0.4);
    animation: reactionShake 0.6s ease-out;
}

@keyframes reactionPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes reactionShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* FIXED: Conversation entry content alignment */
.conversation-entry .content {
    display: flex;
    flex-direction: column;
    max-width: 65%;
    min-width: 250px;
    justify-content: flex-start;
}

/* FIXED: Speaker alignment */
.conversation-entry .speaker {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #555;
    align-self: flex-start;
}

.conversation-entry.player .speaker {
    color: #4a90e2;
}

.conversation-entry.character .speaker {
    color: #e91e63;
}

/* FIXED: Text bubble alignment */
.conversation-entry .text {
    background: #f0f0f0;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    align-self: stretch;
    display: flex;
    align-items: center;
    min-height: 40px;
}

.conversation-entry.player .text {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    border-bottom-right-radius: 4px;
}

.conversation-entry.character .text {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    color: #333;
    border-bottom-left-radius: 4px;
    border-left: 3px solid #e91e63;
}

/* FIXED: Conversation options container */
.conversation-options {
    padding: 25px;
    border-top: 2px solid #e0e0e0;
    background: white;
    border-radius: 0 0 20px 20px;
    display: flex;
    flex-direction: column;
}

.conversation-options h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.1em;
    font-weight: 600;
    text-align: left;
}

/* FIXED: Phrase options container */
.phrase-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 5px;
}

/* FIXED: Main phrase option styling with proper alignment */
.phrase-option {
    padding: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fafafa, #f5f5f5);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    min-height: 80px;
}

.phrase-option:hover {
    border-color: #4a90e2;
    background: linear-gradient(135deg, #f8f9ff, #f0f4ff);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.15);
}

/* FIXED: Phrase text with proper centering */
.phrase-text {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 1em;
    line-height: 1.3;
    text-align: left;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

/* FIXED: Phrase info alignment */
.phrase-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: #666;
    margin-top: auto;
    flex-shrink: 0;
}

.phrase-category {
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: capitalize;
    color: #4a90e2;
    white-space: nowrap;
}

.expected-reaction {
    font-size: 1.4em;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    flex-shrink: 0;
}

/* FIXED: Locked phrase options */
.phrase-option.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
    border-color: #ccc;
    position: relative;
    justify-content: center;
}

.phrase-option.locked:hover {
    transform: none;
    box-shadow: none;
    border-color: #ccc;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
}

.phrase-option.locked .phrase-text {
    color: #888;
}

.phrase-option.locked .phrase-category {
    background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
    color: #999;
}

.phrase-option.locked::before {
    content: "🔒";
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 14px;
    opacity: 0.6;
}

.conversation-ending {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 25px;
    background: linear-gradient(135deg, #e8f5e8, #f0f8f0);
    border-radius: 15px;
    border: 2px solid #4caf50;
    font-weight: 500;
    animation: fadeIn 0.5s ease-out;
}

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

/* Enhanced visual feedback for different phrase categories */
.phrase-option[data-category="romantic"] {
    border-left: 4px solid #e91e63;
}

.phrase-option[data-category="spiritual"] {
    border-left: 4px solid #9c27b0;
}

.phrase-option[data-category="compliment"] {
    border-left: 4px solid #ff9800;
}

.phrase-option[data-category="authentic"] {
    border-left: 4px solid #4caf50;
}

.phrase-option[data-category="party"] {
    border-left: 4px solid #ff5722;
}

/* Scrollbar styling for phrase options */
.phrase-options::-webkit-scrollbar {
    width: 6px;
}

.phrase-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.phrase-options::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.phrase-options::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .conversation-content {
        width: 95%;
        margin: 20px;
    }
    
    .conversation-header {
        padding: 20px;
    }
    
    .character-name {
        font-size: 1.2em;
    }
    
    .character-avatar-small {
        width: 50px;
        height: 50px;
    }
    
    .conversation-log {
        padding: 20px;
        min-height: 200px;
    }
    
    .conversation-portrait {
        width: 60px;
        height: 60px;
        font-size: 1em;
    }
    
    .conversation-entry {
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .conversation-entry .content {
        max-width: 75%;
        min-width: 180px;
    }
    
    .conversation-options {
        padding: 20px;
    }
    
    .phrase-option {
        padding: 15px;
        min-height: 70px;
    }
    
    .phrase-text {
        font-size: 0.9em;
    }
    
    .phrase-info {
        font-size: 0.8em;
    }
    
    .phrase-options {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .conversation-content {
        width: 98%;
        margin: 10px;
        max-height: 90vh;
    }
    
    .conversation-header {
        padding: 15px;
    }
    
    .character-name {
        font-size: 1.1em;
    }
    
    .conversation-log {
        padding: 15px;
        min-height: 150px;
    }
    
    .conversation-portrait {
        width: 50px;
        height: 50px;
        font-size: 0.9em;
    }
    
    .conversation-entry {
        gap: 10px;
        margin-bottom: 18px;
    }
    
    .conversation-entry .content {
        max-width: 80%;
        min-width: 150px;
    }
    
    .conversation-options {
        padding: 15px;
    }
    
    .phrase-option {
        padding: 12px;
        min-height: 60px;
    }
    
    .phrase-text {
        font-size: 0.85em;
        margin-bottom: 6px;
    }
    
    .phrase-info {
        font-size: 0.75em;
    }
}