/* Module Group - Dark Theme Styles */
/* Matches StaffAccountManagement / ModuleGarage card UI patterns */

/* ── Page Container ─────────────────────────────────────────────── */
.mgr-page {
    background: #0F1412;
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* ── Stats Bar ────────────────────────────────────────────────────── */
.mgr-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 1rem 1.25rem;
    border-bottom: 2px solid #2E2E2E;
}

.mgr-stat-card {
    background: #1A1D1C;
    border: 1px solid #2E2E2E;
    border-radius: 14px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.mgr-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.mgr-stat-icon--total {
    background: rgba(45, 212, 191, 0.12);
    color: #2DD4BF;
}

.mgr-stat-icon--active {
    background: rgba(34, 197, 94, 0.12);
    color: #22C55E;
}

.mgr-stat-icon--deleted {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.mgr-stat-value {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.mgr-stat-label {
    color: #6B7280;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Tab Bar ──────────────────────────────────────────────────────── */
.mgr-tabs {
    display: flex;
    gap: 0;
    padding: 0 1.25rem;
    border-bottom: 2px solid #2E2E2E;
    background: #0F1412;
}

.mgr-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: #6B7280;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    transition: color 0.2s, border-color 0.2s;
}

.mgr-tab:hover {
    color: #D1D5DB;
}

.mgr-tab--active {
    color: #2DD4BF;
    border-bottom-color: #2DD4BF;
}

.mgr-tab i {
    font-size: 0.813rem;
}

/* ── Header ───────────────────────────────────────────────────────── */
.mgr-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: #0F1412;
    border-bottom: 2px solid #2E2E2E;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.mgr-header-info {
    flex: 1;
    min-width: 0;
}

.mgr-header-title {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mgr-header-title i {
    color: #2DD4BF;
    font-size: 1.125rem;
}

.mgr-header-subtitle {
    color: #6B7280;
    font-size: 0.813rem;
}

/* ── Search Bar ──────────────────────────────────────────────────── */
.mgr-search-bar {
    padding: 0.75rem 1.25rem;
    border-bottom: 2px solid #2E2E2E;
}

.mgr-search-wrap {
    position: relative;
    max-width: 380px;
}

.mgr-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.813rem;
    color: #6B7280;
    pointer-events: none;
}

.mgr-search-input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    background: #1A1D1C;
    border: 1px solid #2E2E2E;
    border-radius: 0.625rem;
    color: #fff;
    font-size: 0.875rem;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mgr-search-input:focus {
    border-color: #2DD4BF;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.08);
}

/* ── Card Grid ────────────────────────────────────────────────────── */
.mgr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 1.25rem;
}

/* ── Card ──────────────────────────────────────────────────────────── */
.mgr-card {
    background: #1A1D1C;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
    border: none;
}

.mgr-card:hover {
    transform: translateY(-4px);
}

.mgr-card *,
.mgr-card *::before,
.mgr-card *::after {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-image: none !important;
}

.mgr-card-top,
.mgr-card-info,
.mgr-card-badges,
.mgr-card-meta {
    background: transparent !important;
}

/* ── Card Top Row ─────────────────────────────────────────────────── */
.mgr-card-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

/* ── Group Icon ─────────────────────────────────────────────────────── */
.mgr-card-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(45, 212, 191, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #2DD4BF;
    font-size: 1.5rem;
}

/* ── Card Info ─────────────────────────────────────────────────────── */
.mgr-card-info {
    flex: 1;
    min-width: 0;
}

.mgr-card-title {
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.25;
}

.mgr-card-desc {
    color: #A3A3A3;
    font-size: 14px;
    line-height: 1.4;
}

/* ── Card Badges ──────────────────────────────────────────────────── */
.mgr-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.mgr-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.mgr-card-badge--active {
    background: rgba(34, 197, 94, 0.12);
    color: #22C55E;
}

.mgr-card-badge--deleted {
    background: rgba(239, 68, 68, 0.12);
    color: #EF4444;
}

.mgr-card-badge--count {
    background: rgba(45, 212, 191, 0.12);
    color: #2DD4BF;
}

.mgr-card-badge--type {
    background: #252927;
    color: #6B7280;
}

/* ── Card Actions ──────────────────────────────────────────────────── */
.mgr-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.mgr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.813rem;
    border-radius: 0.5rem;
    transition: all 0.15s;
    font-family: inherit;
}

.mgr-btn--primary {
    padding: 0.625rem 1rem;
    border: none;
    background: linear-gradient(135deg, #2DD4BF, #22C55E);
    color: #0F1412;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(45, 212, 191, 0.2);
}

.mgr-btn--primary:hover {
    box-shadow: 0 4px 16px rgba(45, 212, 191, 0.3);
    transform: translateY(-1px);
}

.mgr-btn--edit {
    flex: 1;
    padding: 10px;
    background: #252927;
    border: 1px solid #2E2E2E;
    border-radius: 12px;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.mgr-btn--edit:hover {
    background: #2E2E2E;
}

.mgr-btn--modules {
    flex: 1;
    padding: 10px;
    background: rgba(45, 212, 191, 0.1);
    border: 1px solid rgba(45, 212, 191, 0.3);
    border-radius: 12px;
    color: #2DD4BF;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.mgr-btn--modules:hover {
    background: rgba(45, 212, 191, 0.2);
}

.mgr-btn--delete {
    flex: 1;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #EF4444;
    border-radius: 12px;
    color: #EF4444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.mgr-btn--delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.mgr-btn--restore {
    flex: 1;
    padding: 10px;
    background: rgba(45, 212, 191, 0.1);
    border: 1px solid rgba(45, 212, 191, 0.3);
    border-radius: 12px;
    color: #2DD4BF;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.mgr-btn--restore:hover {
    background: rgba(45, 212, 191, 0.2);
}

.mgr-btn--pdelete {
    flex: 1;
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #EF4444;
    border-radius: 12px;
    color: #EF4444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
}

.mgr-btn--pdelete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.mgr-btn--cancel {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid #2E2E2E;
    font-weight: 600;
    font-size: 0.875rem;
    background: #1A1D1C;
    color: #D1D5DB;
    cursor: pointer;
    font-family: inherit;
}

.mgr-btn--cancel:hover {
    background: #252927;
}

.mgr-btn--danger {
    flex: 1;
    padding: 0.75rem;
    border-radius: 0.625rem;
    border: none;
    font-weight: 700;
    font-size: 0.875rem;
    background: #EF4444;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
}

.mgr-btn--danger:hover {
    background: #DC2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.mgr-btn--back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #252927;
    border: 1px solid #2E2E2E;
    border-radius: 10px;
    color: #D1D5DB;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
}

.mgr-btn--back:hover {
    background: #2E2E2E;
}

/* ── Empty State ───────────────────────────────────────────────────── */
.mgr-empty {
    text-align: center;
    padding: 4rem 1rem;
}

.mgr-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    color: #4B5563;
    display: block;
}

.mgr-empty-icon--large {
    font-size: 3rem;
    color: #6B7280;
}

.mgr-empty-title {
    color: #fff;
    font-size: 1.063rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.mgr-empty-desc {
    color: #6B7280;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ── Delete Confirmation Overlay ─────────────────────────────────── */
.mgr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.mgr-overlay-card {
    background: #1A1D1C;
    border: 1px solid #2E2E2E;
    border-radius: 0.875rem;
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.mgr-overlay-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.25rem;
    color: #EF4444;
}

.mgr-overlay-title {
    color: #fff;
    font-size: 1.063rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.mgr-overlay-desc {
    color: #9CA3AF;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.mgr-overlay-actions {
    display: flex;
    gap: 0.75rem;
}

/* ── Detail View ──────────────────────────────────────────────────── */
.mgr-detail-header {
    padding: 1rem 1.25rem;
    border-bottom: 2px solid #2E2E2E;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mgr-detail-identity {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mgr-detail-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(45, 212, 191, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #2DD4BF;
    flex-shrink: 0;
}

.mgr-detail-title {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
}

.mgr-detail-subtitle {
    color: #6B7280;
    font-size: 0.813rem;
    margin-top: 2px;
}

.mgr-detail-body {
    padding: 1.25rem;
}

/* ── Detail Section (Flat List) ─────────────────────────────────────── */
.mgr-detail-section {
    margin-bottom: 1.5rem;
}

.mgr-detail-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #2E2E2E;
    color: #fff;
    font-size: 0.938rem;
    font-weight: 600;
}

.mgr-detail-section-header i {
    color: #2DD4BF;
    font-size: 0.875rem;
}

/* ── User Type Section ─────────────────────────────────────────────── */
.mgr-user-type-section {
    margin-bottom: 1.5rem;
}

.mgr-user-type-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #2E2E2E;
}

.mgr-user-type-header i {
    color: #2DD4BF;
    font-size: 0.875rem;
}

.mgr-user-type-title {
    color: #fff;
    font-size: 0.938rem;
    font-weight: 600;
}

.mgr-module-count {
    color: #6B7280;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* ── Module Chips ──────────────────────────────────────────────────── */
.mgr-module-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mgr-module-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 0.813rem;
    font-weight: 500;
}

.mgr-module-chip--assigned {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22C55E;
}

.mgr-module-chip--available {
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid #2E2E2E;
    color: #9CA3AF;
}

.mgr-module-chip-icon {
    font-size: 0.875rem;
}

.mgr-module-chip-remove {
    background: none;
    border: none;
    color: rgba(34, 197, 94, 0.6);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    margin-left: 2px;
    transition: color 0.2s;
}

.mgr-module-chip-remove:hover {
    color: #EF4444;
}

.mgr-module-chip-add {
    background: none;
    border: none;
    color: rgba(107, 114, 128, 0.6);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0;
    margin-left: 2px;
    transition: color 0.2s;
}

.mgr-module-chip-add:hover {
    color: #2DD4BF;
}

.mgr-module-empty {
    color: #4B5563;
    font-size: 0.813rem;
    font-style: italic;
}

/* ── Detail Loading ──────────────────────────────────────────────── */
.mgr-detail-loading {
    text-align: center;
    padding: 4rem 1rem;
    color: #6B7280;
}

.mgr-detail-loading i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
    color: #2DD4BF;
}

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .mgr-stats {
        grid-template-columns: 1fr;
    }

    .mgr-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .mgr-btn--primary {
        width: 100%;
        justify-content: center;
    }

    .mgr-grid {
        grid-template-columns: 1fr;
    }

    .mgr-card-actions {
        flex-direction: column;
    }

    .mgr-overlay-card {
        margin: 1rem;
    }

    .mgr-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
}