/* ==========================================================================
   Enchantment Details Info Modal & Mobile Bottom Sheet
   ========================================================================== */


/* ==========================================================================
   Enchantment Details Info Tooltip, Popover & Bottom Sheet Styles
   ========================================================================== */

/* Info Trigger Button on Cards */
.enchant-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 2px;
    margin-left: 0.2rem;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.72;
    transition: transform var(--transition-fast), opacity var(--transition-fast), filter var(--transition-fast);
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
}

.enchant-info-btn:hover,
.enchant-info-btn:focus-visible {
    opacity: 1;
    transform: scale(1.2);
    filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.6));
    outline: none;
}

/* Modal Backdrop (Mobile or Centered Modal) */
.enchant-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(4, 5, 8, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 1;
    transition: opacity var(--transition-base);
}

.enchant-modal-backdrop.hidden {
    display: none !important;
}

/* Tooltip / Popover Container */
.enchant-details-container {
    position: absolute;
    z-index: 9999;
    max-width: 380px;
    width: calc(100vw - 32px);
    background: var(--bg-surface-elevated);
    border: 1px solid rgba(147, 51, 234, 0.35);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 25px rgba(147, 51, 234, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: auto;
    animation: enchantPopIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

.enchant-details-container.hidden {
    display: none !important;
}

@keyframes enchantPopIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(4px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Centered Desktop Modal Mode */
.enchant-details-container.is-modal:not(.is-bottom-sheet) {
    position: fixed;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
    border-color: rgba(147, 51, 234, 0.5);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(147, 51, 234, 0.3);
    animation: enchantModalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes enchantModalIn {
    from {
        opacity: 0;
        transform: translate(-50%, -46%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Mobile Bottom Sheet Mode */
.enchant-details-container.is-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto !important;
    width: 100vw;
    max-width: 100vw;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: 1px solid rgba(147, 51, 234, 0.45);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(147, 51, 234, 0.25);
    animation: enchantSheetUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes enchantSheetUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Details Card Structure */
.enchant-details-card {
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.enchant-details-card.is-curse {
    border-top: 2px solid #ef4444;
}

.details-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.details-title-area {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.details-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.details-level-cap {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-sm);
    background: rgba(147, 51, 234, 0.18);
    border: 1px solid rgba(147, 51, 234, 0.4);
    color: var(--accent-amethyst);
}

.btn-close-details {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-close-details:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Edition Switcher Tabs inside Details */
.details-edition-tabs {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.edition-tab-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.edition-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.edition-tab-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-highlight);
}

/* Details Body Content */
.details-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.84rem;
}

.details-summary {
    font-weight: 500;
    color: var(--accent-lapis);
    margin: 0;
    line-height: 1.45;
    background: rgba(56, 189, 248, 0.06);
    border-left: 3px solid var(--accent-lapis);
    padding: 0.45rem 0.65rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.details-desc {
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Edition Difference Callout Box */
.enchant-diff-box {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.diff-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: #fbbf24;
}

.diff-body {
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.45;
}

/* Tier Scaling Table */
.details-stats-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.details-stats-section .section-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.details-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.stat-tier-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-tier-row:last-child {
    border-bottom: none;
}

.stat-tier-level {
    padding: 0.35rem 0.5rem 0.35rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-amethyst);
    white-space: nowrap;
    width: 75px;
    vertical-align: top;
}

.stat-tier-val {
    padding: 0.35rem 0;
    color: var(--text-primary);
    line-height: 1.4;
}

/* Details Footer Metadata */
.details-footer-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.76rem;
}

.meta-item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.meta-label {
    color: var(--text-muted);
    font-weight: 600;
    min-width: 95px;
}

.meta-value {
    color: var(--text-secondary);
}

.meta-value.has-conflict {
    color: #fca5a5;
    font-weight: 500;
}

/* Light Theme Overrides for Details */
[data-theme="light"] .enchant-details-container {
    background: #ffffff;
    border-color: rgba(147, 51, 234, 0.25);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15), 0 0 20px rgba(147, 51, 234, 0.1);
}

[data-theme="light"] .enchant-modal-backdrop {
    background: rgba(15, 23, 42, 0.45);
}

[data-theme="light"] .details-title {
    color: #0f172a;
}

[data-theme="light"] .details-summary {
    color: #0369a1;
    background: rgba(14, 165, 233, 0.08);
    border-left-color: #0284c7;
}

[data-theme="light"] .details-desc {
    color: #334155;
}

[data-theme="light"] .enchant-diff-box {
    background: #fffbeb;
    border-color: #fde68a;
}

[data-theme="light"] .diff-header {
    color: #b45309;
}

[data-theme="light"] .diff-body {
    color: #1e293b;
}

[data-theme="light"] .stat-tier-val {
    color: #1e293b;
}

[data-theme="light"] .stat-tier-row {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .edition-tab-btn.active {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
