/* ============================================
   Components CSS - MetaMob
   Styles extraits des vues pour mutualisation
   ============================================ */

/* ============================================
   Messages - Conversation bubbles
   ============================================ */
.messages-container {
    max-height: 500px;
    overflow-y: auto;
}

.message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    margin-bottom: 0.5rem;
}

.message-sent {
    background: linear-gradient(135deg, var(--ocre-violet) 0%, var(--ocre-violet-dark) 100%);
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}

.message-received {
    background-color: var(--ocre-navy-lighter);
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
}

.send-form-wrapper {
    position: relative;
}

.send-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--ocre-overlay-dark-70);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--bs-border-radius);
    z-index: 10;
}

.send-overlay .spinner-border {
    width: 2rem;
    height: 2rem;
    color: var(--ocre-gold);
}

/* ============================================
   Messages - Tribute.js autocomplete
   ============================================ */
.tribute-container {
    background: var(--ocre-navy) !important;
    border: 1px solid var(--ocre-border-light) !important;
    border-radius: var(--bs-border-radius);
    box-shadow: var(--ocre-shadow-dark-lg);
    max-height: 180px;
    overflow-y: auto;
}

.tribute-container ul {
    list-style: none;
    margin: 0;
    padding: 0;
    background: transparent !important;
}

.tribute-container li {
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent !important;
    color: var(--ocre-text-primary) !important;
}

.tribute-container li:hover,
.tribute-container li.highlight {
    background: var(--ocre-navy-lighter) !important;
}

.tribute-container li img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 3px;
    background: var(--ocre-navy-light);
    flex-shrink: 0;
}

.tribute-container li .monster-info {
    flex: 1;
    min-width: 0;
}

.tribute-container li .monster-name {
    color: var(--ocre-text-primary) !important;
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1.2;
}

.tribute-container li .monster-details {
    color: var(--ocre-text-muted) !important;
    font-size: 0.7rem;
    line-height: 1.2;
}

.tribute-container .tribute-loading,
.tribute-container .no-match {
    padding: 0.5rem 0.75rem;
    color: var(--ocre-text-muted) !important;
    font-size: 0.8rem;
    background: transparent !important;
}

/* ============================================
   Messages - Monster mentions
   ============================================ */
.monster-mention {
    color: var(--ocre-gold);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    position: relative;
}

.monster-mention:hover {
    text-decoration: underline;
}

/* ============================================
   Monster Cards - Quest list
   ============================================ */
.monster-card {
    transition: transform var(--ocre-transition-fast), box-shadow var(--ocre-transition-fast);
    border: 2px solid transparent;
}

.monster-card:hover {
    box-shadow: var(--ocre-shadow-dark);
}

.monster-card.status-needed {
    border-color: var(--ocre-overlay-danger-50);
}

.monster-card.status-ok {
    border-color: rgba(144, 190, 109, 0.5);
}

.monster-card.status-excess {
    border-color: var(--ocre-overlay-success-40);
}

.monster-card-bg {
    min-height: 190px;
    background-color: var(--ocre-overlay-dark-30);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.monster-card-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--monster-bg);
    background-size: auto;
    background-position: center top;
    background-repeat: no-repeat;
    opacity: 0.9;
    z-index: 0;
    border-radius: inherit;
}

.monster-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 10px;
    background: linear-gradient(to bottom, var(--ocre-overlay-dark-70) 0%, transparent 100%);
    position: relative;
    z-index: 1;
}

.monster-card-step {
    font-size: var(--ocre-fs-base);
    color: var(--ocre-gray-light);
}

.monster-card-bottom {
    padding: 8px 10px;
    background: linear-gradient(to top, var(--ocre-overlay-dark-85) 0%, var(--ocre-overlay-dark-70) 60%, transparent 100%);
    position: relative;
    z-index: 1;
}

.monster-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.monster-card-level {
    font-weight: var(--ocre-fw-normal);
    color: var(--ocre-gray-light);
    margin-left: 4px;
}

.monster-card-qty .form-control {
    background: var(--ocre-overlay-dark-50);
    border-color: var(--ocre-overlay-light-30);
    color: #fff;
}

.monster-card-qty .btn-outline-light {
    border-color: var(--ocre-overlay-light-30);
}

.monster-card-qty .btn-outline-light:hover {
    background: var(--ocre-overlay-light-15);
}

/* Monster type icons */
.monster-type-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    object-fit: contain;
    cursor: help;
}

.monster-type-icon-table {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    object-fit: contain;
    cursor: help;
}

/* Monster name compact (discovery) */
.monster-name-compact {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

@media (max-width: 768px) {
    .monster-name-compact {
        font-size: 0.8rem;
    }
}

/* ============================================
   Monster Cards - Buttons
   ============================================ */
.monster-location-btn {
    background: var(--ocre-overlay-dark-30);
    border: none;
    color: var(--ocre-cyan);
    padding: 2px 6px;
    font-size: var(--ocre-fs-base);
    border-radius: var(--bs-border-radius-sm);
    line-height: 1;
}

.monster-location-btn:hover {
    background: var(--ocre-overlay-dark-50);
    color: var(--ocre-cyan-light);
}

.monster-trade-btn {
    background: var(--ocre-overlay-dark-30);
    border: none;
    color: var(--ocre-gray-light);
    padding: 2px 6px;
    font-size: var(--ocre-fs-base);
    border-radius: var(--bs-border-radius-sm);
    line-height: 1;
}

.monster-trade-btn:hover {
    background: var(--ocre-overlay-dark-50);
    color: #fff;
}

.monster-trade-btn.has-manual {
    color: var(--ocre-gold);
    background: var(--ocre-overlay-gold-30);
}

.monster-trade-btn.has-manual:hover {
    background: var(--ocre-overlay-gold-50);
    color: #fff;
}

.monster-trade-btn-table {
    color: var(--ocre-gray-light);
}

.monster-trade-btn-table:hover {
    color: var(--ocre-text-primary);
}

.monster-trade-btn-table.has-manual {
    color: var(--ocre-gold);
}

.monster-trade-btn-table.has-manual:hover {
    color: var(--ocre-gold-light);
}

/* ============================================
   Location Popover
   ============================================ */
.location-popover {
    position: fixed;
    z-index: 1050;
    background: var(--ocre-navy-light);
    border: 1px solid var(--ocre-border-light);
    border-radius: var(--bs-border-radius);
    box-shadow: var(--ocre-shadow-dark);
    max-width: 280px;
    min-width: 200px;
}

.location-popover-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--ocre-border-light);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.location-popover-body {
    padding: 8px 12px;
    max-height: 250px;
    overflow-y: auto;
}

.location-zone {
    font-weight: 500;
    color: var(--ocre-gray-light);
    margin-top: 8px;
    margin-bottom: 4px;
}

.location-zone:first-child {
    margin-top: 0;
}

.location-subzone {
    padding-left: 12px;
    font-size: 0.875rem;
    color: var(--ocre-text-primary);
}

/* ============================================
   Trade Modal
   ============================================ */
.trade-modal-monster {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: var(--ocre-overlay-dark-20);
    border-radius: var(--bs-border-radius);
    font-weight: var(--ocre-fw-medium);
}

.trade-modal-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
}

/* ============================================
   Subzone Dropdown
   ============================================ */
.subzone-dropdown {
    z-index: 1050;
    width: max-content;
    min-width: 100%;
    max-width: min(400px, 90vw);
}

@media (max-width: 768px) {
    .subzone-dropdown {
        position: fixed !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%);
        width: calc(100vw - 2rem);
        max-width: none;
        max-height: 80vh;
    }

    .subzone-dropdown .overflow-auto {
        max-height: 50vh !important;
    }
}

@media (min-width: 768px) {
    .subzone-dropdown {
        position: absolute;
        margin-top: 0.25rem;
    }
}

/* ============================================
   Filter Actions Buttons
   ============================================ */
.btn-filter-action {
    background: none;
    border: none;
    color: var(--ocre-gray);
    padding: 2px 6px;
    font-size: var(--ocre-fs-md);
    cursor: pointer;
    transition: color var(--ocre-transition-fast), transform 0.1s ease;
    border-radius: var(--bs-border-radius-sm);
}

.btn-filter-action:hover {
    color: var(--ocre-text-primary);
    background: var(--ocre-overlay-light-10);
}

.btn-filter-action:active {
    transform: scale(0.95);
}

.btn-filter-action.disabled {
    color: var(--ocre-gray);
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-filter-action.disabled:hover {
    color: var(--ocre-gray);
    background: none;
}

.btn-filter-action.has-saved {
    color: var(--ocre-violet);
}

.btn-filter-action.has-saved:hover {
    color: var(--ocre-violet-light);
    background: var(--ocre-overlay-violet-15);
}

/* ============================================
   Profile Monster List
   ============================================ */
.profile-list-header {
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 0.5rem 0.5rem 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-list-header.wanted {
    background: var(--ocre-overlay-danger-15);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-bottom: none;
    color: var(--ocre-danger-light);
}

.profile-list-header.offered {
    background: var(--ocre-overlay-success-15);
    border: 1px solid rgba(0, 200, 83, 0.3);
    border-bottom: none;
    color: var(--ocre-success-light);
}

.profile-list-body {
    border: 1px solid var(--ocre-border-light);
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.profile-monster-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--ocre-border);
    gap: 0.5rem;
}

.profile-monster-item:last-child {
    border-bottom: none;
}

.profile-monster-item:hover {
    background: var(--ocre-overlay-light-05);
}

.profile-monster-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    background: var(--ocre-overlay-dark-20);
    border-radius: var(--bs-border-radius-sm);
    flex-shrink: 0;
}

.profile-monster-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.profile-monster-name {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-monster-meta {
    font-size: 0.7rem;
}

.profile-monster-qty {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 24px;
    text-align: center;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.profile-monster-qty.wanted {
    background: var(--ocre-overlay-danger-20);
    color: var(--ocre-danger-light);
}

.profile-monster-qty.offered {
    background: var(--ocre-overlay-success-20);
    color: var(--ocre-success-light);
}

/* Can trade styles */
.profile-monster-item.can-trade {
    background: var(--ocre-overlay-violet-15);
    border-left: 3px solid var(--ocre-violet);
}

.profile-monster-item.can-trade:hover {
    background: var(--ocre-overlay-violet-25);
}

.profile-visitor-qty {
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 40px;
    text-align: center;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.25rem;
}

.profile-visitor-qty i {
    font-size: 0.7rem;
}

.profile-visitor-qty.offers {
    background: var(--ocre-overlay-success-25);
    color: var(--ocre-success-light);
    border: 1px solid var(--ocre-overlay-success-40);
}

.profile-visitor-qty.wants {
    background: var(--ocre-overlay-danger-25);
    color: var(--ocre-danger-light);
    border: 1px solid var(--ocre-overlay-danger-40);
}

/* Trade match indicator in header */
.trade-match {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.8rem;
}

.trade-match.can-give {
    background: var(--ocre-overlay-success-25);
    color: var(--ocre-success-light);
}

.trade-match.can-receive {
    background: var(--ocre-overlay-danger-25);
    color: var(--ocre-danger-light);
}

/* Trade direction arrow */
.trade-direction-arrow {
    color: var(--ocre-violet);
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ============================================
   Trade Interface
   ============================================ */
.trade-avatar {
    width: 60px;
    height: 60px;
    background: var(--ocre-navy);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--ocre-violet);
}

.trade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.trade-header.give {
    background: var(--ocre-overlay-success-15);
    border-bottom: 2px solid var(--ocre-overlay-success-40);
    color: var(--ocre-success-light);
}

.trade-header.receive {
    background: var(--ocre-overlay-danger-15);
    border-bottom: 2px solid var(--ocre-overlay-danger-40);
    color: var(--ocre-danger-light);
}

.trade-summary {
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.trade-summary.give {
    background: var(--ocre-overlay-success-25);
}

.trade-summary.receive {
    background: var(--ocre-overlay-danger-25);
}

.trade-list {
    max-height: 500px;
    overflow-y: auto;
}

.trade-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--ocre-border);
    gap: 0.75rem;
    transition: background-color var(--ocre-transition-fast);
}

.trade-item:last-child {
    border-bottom: none;
}

.trade-item:hover {
    background: var(--ocre-overlay-light-05);
}

.trade-item.selected {
    background: var(--ocre-overlay-violet-15);
    border-left: 3px solid var(--ocre-violet);
}

.trade-monster-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: var(--ocre-overlay-dark-20);
    border-radius: var(--bs-border-radius-sm);
    flex-shrink: 0;
}

.trade-monster-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.trade-monster-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.trade-monster-meta {
    font-size: 0.75rem;
}

.trade-qty-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.trade-qty-info .badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
}

.trade-qty-input {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.trade-qty-input .btn {
    padding: 0.15rem 0.4rem;
}

.trade-qty-input input {
    background: var(--ocre-navy);
    border-color: var(--ocre-border);
    color: inherit;
}

.trade-qty-input input:focus {
    background: var(--ocre-navy-light);
    border-color: var(--ocre-violet);
    box-shadow: 0 0 0 0.2rem var(--ocre-overlay-violet-25);
}

/* ============================================
   Avatar Card (overflow fix for dropdowns)
   ============================================ */
.avatar-card {
    overflow: visible !important;
}

/* ============================================
   Cursor pointer utility
   ============================================ */
.cursor-pointer {
    cursor: pointer;
}

/* ============================================
   Community - Cards & Trade Bar
   ============================================ */
.community-card {
    transition: box-shadow var(--ocre-transition-fast);
}
.community-card:hover {
    box-shadow: var(--ocre-shadow-dark);
}

/* Trade compatibility bar */
.trade-bar {
    display: flex;
    height: 24px;
    background: var(--ocre-navy);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--ocre-border);
}

.trade-bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.trade-bar-segment.give {
    background: linear-gradient(90deg, var(--ocre-overlay-success-40), rgba(0, 200, 83, 0.6));
    border-right: 1px solid var(--ocre-border);
}

.trade-bar-segment.get {
    background: linear-gradient(90deg, var(--ocre-overlay-danger-40), rgba(220, 53, 69, 0.6));
    margin-left: auto;
}

.trade-bar-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.trade-bar-placeholder {
    background: var(--ocre-navy);
    border-radius: 4px;
    border: 1px dashed var(--ocre-border);
}

/* Compact trade bar for table view */
.trade-bar-sm {
    height: 20px;
}

.trade-bar-sm .trade-bar-count {
    font-size: 0.7rem;
}

/* Community table */
.community-table {
    border-collapse: separate;
    border-spacing: 0;
}

.community-table th {
    background: var(--ocre-navy);
    border-bottom: 2px solid var(--ocre-border);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.community-table td {
    border-bottom: 1px solid var(--ocre-border);
    vertical-align: middle;
}

.community-table tbody tr:hover {
    background-color: var(--ocre-overlay-light-05);
}

/* ============================================
   Conversations - List items
   ============================================ */
.conversation-item {
    background: transparent;
    border-color: var(--ocre-border-light) !important;
    transition: background-color var(--ocre-transition-fast);
}
.conversation-item:hover {
    background: var(--ocre-navy-light);
}

.conversation-unread {
    border-left: 3px solid var(--ocre-violet) !important;
    background: linear-gradient(90deg, var(--ocre-overlay-violet-08), transparent);
}
.conversation-unread:hover {
    background: linear-gradient(90deg, var(--ocre-overlay-violet-15), var(--ocre-navy-light));
}

.message-preview {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   Notifications - Cards
   ============================================ */
.notification-card {
    transition: border-color var(--ocre-transition-fast);
}
.notification-card:hover {
    border-color: var(--ocre-violet) !important;
}
.notification-card.unread {
    background: linear-gradient(to right, var(--ocre-overlay-violet-08), transparent);
    border-left: 3px solid var(--ocre-violet);
}

.notification-preview {
    line-height: 1.5;
}
