/* ==========================================================================
   Expeditions UI Styles
   Matches the Dark Fantasy flexbox layout of DDDungeon
   ========================================================================== */

.expeditions-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .expeditions-layout {
        padding: 0;
        gap: 0.5rem;
    }
}

.expedition-locked-req {
    color: var(--clr-text-dim);
    font-size: 0.9em;
}

.expedition-idle-status {
    color: var(--clr-text-dim);
}

.expedition-no-heroes {
    padding: 1rem;
    color: var(--clr-text-dim);
    text-align: center;
    grid-column: 1/-1;
}

.dim-display {
    min-width: 20px;
    text-align: center;
    font-weight: bold;
}

.config-toggle-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    margin-left: 12px;
    font-size: 0.85em;
    color: var(--clr-text-dim);
}

.expedition-preflight {
    font-size: 0.85em;
    padding: 4px 0;
}

.expedition-preflight.idle {
    color: var(--clr-text-dim);
}

.expedition-preflight.success {
    color: var(--clr-success);
}

.expedition-preflight.warning {
    color: var(--clr-warning);
}

.expedition-preflight.danger {
    color: var(--clr-danger);
}

.expedition-team-power {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.6rem;
    border: 1px solid var(--clr-border-light);
    border-radius: 4px;
    background: var(--clr-surface-dark);
}

.expedition-team-power-title {
    color: var(--clr-accent);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    letter-spacing: 0.4px;
}

.team-stats-row,
.team-performance-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    color: var(--clr-text);
    font-size: 0.8rem;
}

.team-stats-row span,
.team-performance-row span {
    white-space: nowrap;
}

.team-performance-row {
    color: var(--clr-text);
}

.difficulty-rating {
    color: var(--clr-text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--clr-border-light);
    padding-top: 0.35rem;
}

.btn-reset-team {
    background: var(--clr-surface-dark);
    color: var(--clr-text-dim);
    border: 1px solid var(--clr-border);
    font-size: 0.8em;
    padding: 4px 10px;
    cursor: pointer;
}

.expedition-status.running {
    color: var(--clr-success);
}

.hero-select-card .portrait-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-surface-dark);
    border: 1px dashed var(--clr-border);
}

.hero-select-info.compact {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.hero-select-name.compact {
    line-height: 1.2;
}

.hero-select-level.compact {
    font-size: 0.85em;
    opacity: 0.8;
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--clr-text-dim);
    line-height: 1.2;
}

.hero-dps,
.hero-mps {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.hero-dps {
    color: var(--clr-gold);
}

.hero-mps {
    color: var(--clr-info);
}

.expeditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

@media (max-width: 768px) {
.expedition-simulating {
    color: var(--clr-text-dim);
    text-align: center;
    padding: 8px;
}

.team-stats-row,
.team-performance-row {
    flex-direction: column;
    gap: 0.2rem;
}

.expeditions-grid {

        grid-template-columns: 1fr;
    }
}

/* Expedition Card */
.expedition-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: 4px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.expedition-card.state-running {
    border-color: var(--clr-info);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.1);
}

.expedition-card.state-completed {
    border-color: var(--clr-success);
    box-shadow: 0 0 15px rgba(78, 204, 163, 0.2);
}

.expedition-card.state-completed::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(78, 204, 163, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Header */
.expedition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--clr-border-light);
    padding-bottom: 0.5rem;
}

.expedition-title {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    color: var(--clr-accent);
    margin: 0;
}

.expedition-status {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.25rem 0.5rem;
    border-radius: 2px;
    background: var(--clr-surface-dark);
}

.state-idle .expedition-status { color: var(--clr-text-dim); }
.state-running .expedition-status { color: var(--clr-info); }
.state-completed .expedition-status { color: var(--clr-success); font-weight: bold; }

/* Team Slots */
.expedition-team {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.5rem;
    background: var(--clr-surface-dark);
    border-radius: 4px;
    min-height: 80px;
}

.expedition-slot {
    width: 60px;
    height: 60px;
    border: 1px dashed var(--clr-border-light);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-surface);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.expedition-slot:hover {
    border-color: var(--clr-accent);
    background: var(--clr-btn-hover-bg);
}

.expedition-slot.filled {
    border-style: solid;
    border-color: var(--clr-border-light);
    padding: 2px;
}

.expedition-slot.locked {
    cursor: not-allowed;
    opacity: 0.8;
}

.expedition-slot.locked::after {
    content: '🔒';
    position: absolute;
    bottom: -5px;
    right: -5px;
    font-size: 0.75rem;
    background: var(--clr-surface-dark);
    border-radius: 50%;
    width: 20px; height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--clr-border);
}

.expedition-slot .hero-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2px;
}

.expedition-slot .empty-icon {
    color: var(--clr-text-dim);
    font-size: 1.5rem;
}

/* Configuration (Idle) */
.expedition-config {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.config-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-label {
    color: var(--clr-text-dim);
    font-size: 0.875rem;
}

.config-select {
    background: var(--clr-surface-dark);
    color: var(--clr-text);
    border: 1px solid var(--clr-border-light);
    padding: 0.25rem 0.5rem;
    border-radius: 2px;
    outline: none;
    font-family: var(--font-body);
}

.config-select:focus {
    border-color: var(--clr-accent);
}

/* Power Display */
.expedition-power {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--clr-surface-dark);
    border-radius: 2px;
    font-size: 0.875rem;
}

.power-value {
    font-family: var(--font-mono);
    font-weight: bold;
}

.power-sufficient .power-value.current { color: var(--clr-success); }
.power-insufficient .power-value.current { color: var(--clr-danger); }

/* Running State Info */
.expedition-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 1rem 0;
}

.expedition-min-time {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: left;
}

.expedition-min-time-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--clr-text-dim);
}

.expedition-min-time-label {
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.expedition-min-time-text {
    font-family: var(--font-mono);
    color: var(--clr-text);
}

.expedition-min-time-track {
    width: 100%;
    height: 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--clr-border-light);
    background: var(--clr-surface-dark);
    overflow: hidden;
}

.expedition-min-time-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--clr-warning), var(--clr-accent));
    transition: width 0.35s ease;
}

.expedition-min-time-fill.ready {
    background: linear-gradient(90deg, var(--clr-success), var(--clr-accent-bright));
}

.expedition-estimate {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    text-align: left;
    padding: 0.5rem;
    border: 1px solid var(--clr-border-light);
    border-radius: 4px;
    background: var(--clr-surface-dark);
}

.expedition-estimate-title {
    font-size: 0.8rem;
    color: var(--clr-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.expedition-estimate-bar {
    width: 100%;
    height: 0.5rem;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--clr-border-light);
    background: var(--clr-surface);
}

.expedition-estimate-bar-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--clr-info), var(--clr-accent-bright));
    transition: width 0.35s ease;
}

.expedition-estimate-floors {
    font-family: var(--font-mono);
    color: var(--clr-accent-bright);
    font-size: 0.9rem;
}

.expedition-estimate-row {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--clr-text);
}

@media (max-width: 768px) {
    .expedition-estimate-row {
        flex-direction: column;
        gap: 0.2rem;
    }
}

.time-remaining {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    color: var(--clr-accent-bright);
    text-shadow: 0 0 5px rgba(214, 162, 77, 0.3);
}

.destination-info {
    color: var(--clr-text-dim);
    font-size: 0.875rem;
}

/* Completed State Info */
.completion-info {
    text-align: center;
    padding: 1rem 0;
    color: var(--clr-text);
}

/* Actions */
.expedition-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.btn-deploy {
    width: 100%;
    padding: 0.75rem;
    background: var(--clr-btn-bg);
    color: var(--clr-accent);
    border: 1px solid var(--clr-accent-dim);
    font-family: var(--font-primary);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-deploy:hover:not(:disabled) {
    background: var(--clr-accent);
    color: var(--clr-btn-text-on-accent);
}

.btn-deploy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--clr-border-light);
    color: var(--clr-text-dim);
}

.btn-recall {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    color: var(--clr-danger);
    border: 1px solid var(--clr-danger);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-recall:hover {
    background: var(--clr-danger);
    color: white;
}

.btn-recall:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    color: var(--clr-text-dim);
    border-color: var(--clr-border-light);
    background: transparent;
}

.btn-recall:disabled:hover {
    background: transparent;
    color: var(--clr-text-dim);
}

.btn-claim {
    width: 100%;
    padding: 1rem;
    background: rgba(78, 204, 163, 0.1);
    color: var(--clr-success);
    border: 1px solid var(--clr-success);
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    animation: pulse-success 2s infinite;
    transition: all 0.2s ease;
}

.btn-claim:hover {
    background: var(--clr-success);
    color: var(--clr-bg);
    animation: none;
}

@keyframes pulse-success {
    0% { box-shadow: 0 0 0 0 rgba(78, 204, 163, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(78, 204, 163, 0); }
    100% { box-shadow: 0 0 0 0 rgba(78, 204, 163, 0); }
}

/* Hero Selection Modal for Expeditions */
.hero-select-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--clr-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.hero-select-content {
    background: var(--clr-bg);
    border: 1px solid var(--clr-border);
    border-radius: 4px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.hero-select-header {
    padding: 1rem;
    border-bottom: 1px solid var(--clr-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hero-select-header h3 {
    margin: 0;
    color: var(--clr-accent);
    font-family: var(--font-primary);
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--clr-text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

.btn-close-modal:hover {
    color: var(--clr-text);
}

.hero-select-body {
    padding: 1rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.hero-select-card {
    background: var(--clr-surface);
    border: 1px solid var(--clr-border-light);
    padding: 0.5rem;
    border-radius: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.hero-select-card:hover {
    border-color: var(--clr-accent);
    background: var(--clr-surface-light);
}

.hero-select-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--clr-border-dim);
}

.hero-select-card.disabled:hover {
    background: var(--clr-surface);
    border-color: var(--clr-border-dim);
}

.hero-select-card .portrait-sm {
    width: 40px; height: 40px;
    border-radius: 2px;
    object-fit: cover;
}

.hero-select-info {
    display: flex;
    flex-direction: column;
}

.hero-select-name {
    font-size: 0.875rem;
    font-weight: bold;
    color: var(--clr-text);
}

.hero-select-level {
    font-size: 0.75rem;
    color: var(--clr-text-dim);
}

.hero-select-status {
    font-size: 0.7rem;
    color: var(--clr-warning);
    margin-top: 2px;
}

/* Expedition Spoils Narrative Report */
.expedition-spoils-narrative {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.narrative-text {
    margin: 0;
    padding: 0.75rem;
    border: 1px solid var(--clr-border-light);
    background: var(--clr-surface-dark);
    color: var(--clr-text);
    line-height: 1.5;
    border-radius: 4px;
}

.highlights-section,
.spoils-section {
    border: 1px solid var(--clr-border-light);
    border-radius: 4px;
    background: var(--clr-surface-dark);
    padding: 0.75rem;
}

.highlights-section h4,
.spoils-section h4 {
    margin: 0 0 0.5rem;
    color: var(--clr-accent);
    font-family: var(--font-primary);
    font-size: 1rem;
}

.highlights-section ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.highlights-section li {
    color: var(--clr-text);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.highlight-icon {
    line-height: 1.2;
}

.spoils-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.spoils-tile {
    border: 1px solid var(--clr-border-light);
    border-radius: 4px;
    background: var(--clr-surface);
    padding: 0.5rem 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.spoils-tile span {
    color: var(--clr-text-dim);
    font-size: 0.82rem;
}

.spoils-tile strong {
    color: var(--clr-text);
    font-family: var(--font-mono);
    font-weight: bold;
}

.run-log-details {
    border: 1px solid var(--clr-border-light);
    border-radius: 4px;
    background: var(--clr-surface-dark);
    padding: 0.5rem 0.75rem;
}

.run-log-details > summary {
    cursor: pointer;
    color: var(--clr-text-dim);
    font-weight: 600;
    user-select: none;
}

.run-log-details > summary:hover {
    color: var(--clr-accent);
}

.run-log-details[open] > summary {
    color: var(--clr-accent-bright);
    margin-bottom: 0.5rem;
}

.run-log-details .offline-spoils-run-log {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.run-log-details .spoils-run-entry {
    border: 1px solid var(--clr-border-light);
    border-radius: 3px;
    background: var(--clr-surface);
    padding: 0.5rem;
}

.run-log-details .spoils-run-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    color: var(--clr-text);
    font-size: 0.85rem;
}

.run-log-details .spoils-run-detail {
    margin-top: 0.35rem;
}

.run-log-details .spoils-run-detail-content {
    color: var(--clr-text-dim);
    font-size: 0.82rem;
    line-height: 1.35;
}

@media (max-width: 768px) {
    .spoils-grid {
        grid-template-columns: 1fr;
    }

    .run-log-details .spoils-run-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
}
