/* ================================================== */
/* == START: CSS for Channel Manager UI (Cleaned)   == */
/* ================================================== */

/* --- Container & General Layout --- */
#channel-manager-view {
    padding: 30px;
    background-color: #f9fafb;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.cm-header {
    font-size: 1.7em;
    margin-bottom: 20px;
    color: #1f2937;
    display: flex;
    align-items: center;
    font-weight: 600;
}
.cm-header i {
    color: #4f46e5;
    font-size: 1em;
    margin-right: 12px;
}

/* --- Internal Navigation Wrapper & Arrows --- */
.cm-nav-wrapper {
    position: relative;
    margin-bottom: 30px;
    background-color: #e5e7eb; /* Grey background for the bar */
    border-radius: 6px 6px 0 0;
    padding: 0 45px; /* Space for inactive arrows */
    /* The wrapper provides the visual bar area */
}

.cm-scroll-arrow { /* Styles for arrows (inactive for now) */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #d1d5db;
    color: #4b5563;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.cm-scroll-arrow:hover {
    background-color: #ffffff;
    color: #1f2937;
    border-color: #adb5bd;
}
.cm-scroll-arrow:active {
    transform: translateY(-50%) scale(0.95);
}
.cm-scroll-arrow i {
    font-size: 0.9em;
}
#cm-scroll-left { left: 8px; }
#cm-scroll-right { right: 8px; }


/* --- Internal Navigation Tabs Area (Corrected) --- */
.cm-nav {
    display: flex;         /* Use flex for aligning items inside */
    width: fit-content;    /* <<< Makes the nav container only as wide as needed */
    overflow-x: auto;      /* Allows scrolling *if* fit-content width exceeds wrapper */
    overflow-y: hidden;
    padding: 0;            /* No padding needed on the scrolling container itself */
    position: relative;
    top: 1px;              /* Optional visual nudge */
    max-width: 100%;       /* Prevent overflow if fit-content fails */

    /* Hide the scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.cm-nav::-webkit-scrollbar { /* Webkit */
    display: none;
}

.cm-nav-link {
    padding: 12px 20px;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 500;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex; /* Use inline-flex for items */
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    border-radius: 4px 4px 0 0;
    margin-bottom: 0;
    flex-shrink: 0; /* Prevent tabs from shrinking */
}

.cm-nav-link i {
    font-size: 1.1em;
    color: inherit;
    transition: color 0.2s ease;
}

.cm-nav-link:hover {
    color: #1f2937;
    background-color: #f3f4f6;
}
.cm-nav-link:hover i {
    color: #1f2937;
}

.cm-nav-link.active {
    background-color: #4f46e5; /* Indigo background */
    color: #ffffff; /* White text */
    font-weight: 600;
}

.cm-nav-link.active i {
    color: #ffffff; /* White icon */
}

/* --- Content Area & Sections --- */
.cm-content-area {
    /* Container for the specific section views */
}
.cm-section {
    display: none;
    animation: cm-fadeIn 0.3s ease-out;
}
.cm-section.active {
    display: block;
}

@keyframes cm-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Dashboard Grid --- */
.cm-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
}

/* --- Widget Styling --- */
.cm-widget {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 20px 25px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.cm-widget h4 {
    font-size: 1.1em;
    color: #1f2937;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    font-weight: 600;
}
.cm-widget h4 i {
    margin-right: 10px;
    color: #9ca3af;
}
.cm-widget-link {
    display: block;
    margin-top: auto;
    padding-top: 15px;
    font-size: 0.9em;
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
    text-align: right;
    border-top: 1px solid #f3f4f6;
}
.cm-widget-link:hover { text-decoration: underline; }
.cm-widget-link i { margin-left: 4px; }

/* Metrics Widget */
.cm-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 20px;
    margin-bottom: 20px;
}
.cm-metric-item { text-align: center; }
.cm-metric-item .value {
    display: block;
    font-size: 1.8em;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}
.cm-metric-item .label {
    display: block;
    font-size: 0.85em;
    color: #6b7280;
}

/* Quick Actions Widget (Using Flexbox) */
.cm-actions-widget .cm-actions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}
.cm-actions-widget button {
    flex-grow: 1;
    flex-basis: 150px;
    min-width: 140px;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px 10px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.2s ease;
    gap: 8px;
    min-height: 80px;
}
.cm-actions-widget button:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.cm-actions-widget button i {
    font-size: 1.5em;
    color: #4f46e5;
    margin-bottom: 5px;
}

/* Recent Activity Widget */
.cm-activity-list {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    max-height: 300px;
    overflow-y: auto;
    min-width: 0;
}
.cm-activity-list li {
    display: flex;
    align-items: center;
    padding: 10px 5px;
    border-bottom: 1px dotted #eee;
    font-size: 0.9em;
    color: #4b5563;
    gap: 10px;
    overflow: hidden;
}
.cm-activity-list li:last-child { border-bottom: none; }
.cm-activity-list .icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.cm-activity-list .icon.user { background-color: #10b981; }
.cm-activity-list .icon.comment { background-color: #3b82f6; }
.cm-activity-list .icon.event { background-color: #a855f7; }
.cm-activity-list .icon.mail { background-color: #f59e0b; }
.cm-activity-list .icon.content { background-color: #6b7280; }

.cm-activity-list .time {
    font-size: 0.9em;
    color: #9ca3af;
    margin-left: auto;
    white-space: nowrap;
    padding-left: 10px;
    flex-shrink: 0;
}
.cm-activity-list .view-action {
    font-size: 0.9em;
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
    margin-left: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}
.cm-activity-list .view-action:hover { text-decoration: underline; }

/* Moderation Widget */
.cm-moderation-list {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    min-width: 0;
}
.cm-moderation-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dotted #eee;
    font-size: 0.9em;
    color: #374151;
    overflow: hidden;
}
.cm-moderation-list li:last-child { border-bottom: none; }
.cm-moderation-list .count {
    background-color: #fecaca;
    color: #b91c1c;
    font-size: 0.8em;
    font-weight: bold;
    padding: 2px 7px;
    border-radius: 10px;
    margin-right: 10px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
}
.cm-moderation-list a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.cm-moderation-list a:hover { text-decoration: underline; }
.cm-empty-state {
     font-size: 0.9em;
     color: #6b7280;
     text-align: center;
     padding: 20px 0;
     font-style: italic;
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
    .cm-dashboard-grid { /* Stacks naturally */ }
}

@media (max-width: 768px) {
    #channel-manager-view { padding: 20px; }
    .cm-header { font-size: 1.5em; margin-bottom: 15px; }
    .cm-nav-wrapper { padding: 0 40px; margin-bottom: 20px; }
    #cm-scroll-left { left: 5px; }
    #cm-scroll-right { right: 5px; }
    .cm-nav-link { padding: 8px 12px; font-size: 0.9em; }
    .cm-widget { padding: 15px 20px; }
    .cm-widget h4 { font-size: 1.05em; }
    .cm-metrics-grid { grid-template-columns: 1fr 1fr; gap: 10px 15px; }
    .cm-metric-item .value { font-size: 1.6em; }
    .cm-actions-widget button { font-size: 0.85em; min-height: 70px; gap: 5px; flex-basis: 120px; }
    .cm-actions-widget button i { font-size: 1.3em; }
}
@media (max-width: 576px) {
     .cm-header { font-size: 1.3em; }
     .cm-nav-wrapper { padding: 0 35px; }
     #cm-scroll-left { left: 3px; width: 28px; height: 28px; }
     #cm-scroll-right { right: 3px; width: 28px; height: 28px; }
     .cm-scroll-arrow i { font-size: 0.8em; }
     .cm-nav-link { gap: 5px; padding: 8px 10px; }
     .cm-nav-link i { display: none; }
     .cm-metrics-grid { grid-template-columns: 1fr; }
     .cm-actions-widget .cm-actions-grid { grid-template-columns: 1fr 1fr; gap: 10px;}
     .cm-actions-widget button { flex-basis: auto; }
}

/* ================================================ */
/* == END: CSS for Channel Manager UI (Cleaned)   == */
/* ================================================ */