/* ===== LEADER SCREEN REDESIGN ===== */
.mgmt-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 16px;
    padding: 0 4px;
}

#btn-new-club {
    width: auto !important;
    padding: 8px 20px !important;
    font-size: 14px;
    border-radius: 100px;
}

.mgmt-subtitle {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.club-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 8px;
}

@media (min-width: 992px) {
    .club-grid-layout {
        grid-template-columns: 1fr 1fr;
    }
}

.club-card {
    background: linear-gradient(135deg, var(--surface), var(--bg3));
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.club-card:hover {
    border-color: var(--purple-light);
    background: var(--surface-elevated);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.club-card.active-card {
    border-color: var(--purple-light);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(124, 58, 237, 0.05));
    box-shadow: 0 10px 40px rgba(124, 58, 237, 0.2);
}

@media (max-width: 991px) {
    .club-card {
        padding: 20px;
        border-radius: 22px;
    }
}

.club-card-main {
    display: flex;
    align-items: center;
    gap: 16px;
}

.club-card-avatar,
.club-card-avatar-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg3);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.club-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.club-card-avatar-placeholder {
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: white;
    font-weight: 900;
    font-size: 28px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.club-card-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.club-card-title {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}

.club-card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.club-card-top-actions {
    display: flex;
    gap: 6px;
}

.club-card-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.club-card-manage-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.club-card-manage-btn:hover {
    background: var(--surface2);
    border-color: var(--purple-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.club-card.active-card .club-card-manage-btn {
    background: rgba(124, 58, 237, 0.1);
}

/* Tab pane adjustments */
.mgmt-tab-pane {
    display: none;
}

.mgmt-tab-pane.active {
    display: block;
}

/* Modal Close Button Refinement */
.modal-mgmt-header .btn-icon,
.flash-header .flash-close,
.scp-close,
.mf-close,
.modal-header .modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.modal-mgmt-header .btn-icon:hover,
.flash-header .flash-close:hover,
.scp-close:hover,
.mf-close:hover,
.modal-header .modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    /* Subtle red tint */
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444 !important;
    transform: rotate(90deg) scale(1.1);
}

/* ===== TOGGLE SWITCH ===== */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background-color: var(--purple);
    border-color: var(--purple-light);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--purple);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* ===== ELEGANT LIST REFINEMENTS ===== */
.items-list .item-row {
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

/* Pathfinder Count Badge */
.pf-count-badge {
    background: var(--bg3);
    color: var(--purple-light);
    font-size: 13px;
    font-weight: 800;
    padding: 2px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    box-shadow: var(--shadow-sm);
    margin-right: 4px;
}

.items-list .item-row:first-child {
    border-radius: 18px 18px 0 0;
}

.items-list .item-row:last-child {
    border-radius: 0 0 18px 18px;
    border-bottom: none;
}

.items-list .item-row:only-child {
    border-radius: 18px;
}

.items-list .item-row:active {
    background: rgba(255, 255, 255, 0.06);
    transform: scale(0.99);
}

/* Add Native Arrow to Rows */
.items-list .item-row::after {
    content: '❯';
    margin-left: 12px;
    font-size: 14px;
    color: var(--text-dim);
    opacity: 0.5;
}

.items-list .item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.items-list .item-status-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: right;
}

.items-list .item-status-text {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-released {
    color: var(--green);
}

.status-blocked {
    color: var(--text-dim);
}

.items-list .item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-materials {
    font-size: 13px !important;
    padding: 8px 12px !important;
    color: var(--text-dim) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(255, 255, 255, 0.03) !important;
}

.btn-materials:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

/* ===== CHAPTER ARTIFACTS EXPANDER ===== */
.chapter-card-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chapter-card-wrapper .item-row {
    border-bottom: none !important;
}

.item-materials-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(0, 0, 0, 0.2);
}

.item-materials-panel.expanded {
    max-height: 1000px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.materials-content {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    background: rgba(255, 255, 255, 0.01);
}

.material-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.material-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(108, 99, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.material-icon {
    font-size: 20px;
    width: 36px;
    height: 36px;
    background: rgba(124, 58, 237, 0.15);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.material-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.material-type {
    font-size: 10px;
    font-weight: 800;
    color: var(--purple-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.material-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.material-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--text-dim);
    font-size: 13px;
    font-style: italic;
}

.material-item.material-audio {
    grid-column: auto; /* back to normal! */
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.1);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

.material-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.material-item.material-audio .material-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
    background: rgba(124, 58, 237, 0.15);
    border-radius: 10px;
}

.material-item .btn-download {
    background: rgba(108, 99, 255, 0.1);
    color: var(--purple-light) !important;
    font-size: 11px;
    font-weight: 800;
    padding: 8px 14px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(108, 99, 255, 0.2);
    margin-left: auto;
}

.material-item .btn-download:hover {
    background: var(--purple-light);
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.material-item.material-audio audio {
    width: 100%;
    height: 32px;
    filter: invert(100%) hue-rotate(180deg) brightness(1.2);
    display: block;
}

/* Adjust for smaller screens where audio might still need column */
@media (max-width: 800px) {
    .material-item.material-audio {
        flex-direction: column;
        align-items: flex-start;
    }
    .material-item.material-audio audio {
        max-width: 100%;
        margin-top: 12px;
    }
}

/* ===== CHAPTERS LIST REDESIGN (MOBILE-FIRST) ===== */
.chapter-card-wrapper {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chapter-item-row {
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease;
}

.chapter-item-row.plan-restricted {
    opacity: 0.8;
}

.item-main {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-pill-text {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.status-pill-text.status-released {
    background: var(--green-bg);
    color: var(--green);
}

.status-pill-text.status-blocked {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.item-actions-row {
    padding: 0 20px 20px;
}

.btn-materials-elegant {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0, 0, 0.2, 1);
}

.btn-materials-elegant:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--purple-light);
    transform: translateY(-1px);
}

.btn-materials-elegant:active:not(:disabled) {
    transform: translateY(0);
}

.btn-materials-elegant:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-materials-elegant .btn-icon {
    font-size: 18px;
}

.btn-materials-elegant .btn-arrow {
    margin-left: auto;
    font-size: 12px;
    opacity: 0.5;
}

/* Mobile Overrides (Stacked Layout) */
@media (max-width: 600px) {
    .item-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding-bottom: 16px;
    }
    
    .item-controls {
        width: 100%;
        justify-content: space-between;
        padding-top: 14px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .item-info .item-name {
        font-size: 16px;
        font-weight: 850;
    }

    /* Materials Panel Adjustments */
    .materials-content {
        grid-template-columns: 1fr;
        padding: 16px;
    }
}

/* Generic List Row Adjustments (Pathfinders, etc.) */
.items-list .item-row {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

/* ===== ENGAGEMENT DASHBOARD STYLES ===== */
.engagement-card {
    background: linear-gradient(145deg, var(--surface), var(--bg3));
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.eng-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.eng-card-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.eng-card-title span {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    margin-right: 8px;
}

.eng-bar-container {
    width: 100%;
    height: 18px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    display: flex;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

.eng-bar-segment {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tooltip info inside segments if needed, but we'll use a legend below */
.eng-bar-completed {
    background: linear-gradient(90deg, #10b981, #059669); /* Emerald */
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.3);
}

.eng-bar-progress {
    background: linear-gradient(90deg, #f59e0b, #d97706); /* Amber */
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.3);
}

.eng-bar-notstarted {
    background: linear-gradient(90deg, #6b7280, #4b5563); /* Gray */
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1);
}

.eng-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    margin-top: 4px;
    flex-wrap: wrap;
}

.eng-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.eng-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.eng-dot-completed { background: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.eng-dot-progress { background: #f59e0b; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
.eng-dot-notstarted { background: #6b7280; box-shadow: 0 0 8px rgba(107, 114, 128, 0.5); }

/* ===== ENGAGEMENT TABS ===== */
.eng-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.eng-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.eng-tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.eng-tab-btn.active {
    background: var(--purple-light);
    color: #fff;
    box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
}

.eng-tab-pane {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.eng-tab-pane.active {
    display: block;
}

.eng-unit-selector-wrapper select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease;
    cursor: pointer;
}

.eng-unit-selector-wrapper select:focus {
    border-color: var(--purple-light);
}

.eng-unit-selector-wrapper select option {
    background: var(--bg3);
    color: #fff;
}