/* ===================================
   CIRCLE ADVANCED FEATURES
   - Rules page
   - Moderator tools
   - Member management
   - Post flairs
   =================================== */

/* ==================== CIRCLE RULES PAGE ==================== */

.circle-rules-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

.rules-header {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.rules-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.rules-header-description {
    color: #7c7c7c;
    font-size: 14px;
    margin-bottom: 16px;
}

.rules-header-actions {
    display: flex;
    gap: 12px;
}

.rules-list {
    background: var(--bg-primary);
    border: var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.rule-item {
    padding: 20px 24px;
    border-bottom: 1px solid #edeff1;
    position: relative;
}

.rule-item:last-child {
    border-bottom: none;
}

.rule-item:hover {
    background: #f8f9fa;
}

.rule-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
}

.rule-number {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.rule-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #1c1c1c;
    margin: 4px 0 0 0;
}

.rule-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.rule-item:hover .rule-actions {
    opacity: 1;
}

.rule-description {
    color: #7c7c7c;
    font-size: 14px;
    line-height: 1.5;
    margin-left: 48px;
}

.rule-edit-form {
    margin: 16px 0 0 48px;
    padding: 16px;
    background: #f6f7f8;
    border-radius: 8px;
}

.rule-edit-form input,
.rule-edit-form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 12px;
    font-family: inherit;
}

.rule-edit-form textarea {
    min-height: 80px;
    resize: vertical;
}

.rule-edit-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.add-rule-button {
    position: sticky;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    margin: 24px auto 0;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 8px;
}

.add-rule-button:hover {
    background: #003d82;
}

/* Empty state */
.rules-empty {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 48px 24px;
    text-align: center;
}

.rules-empty-icon {
    width: 64px;
    height: 64px;
    opacity: 0.3;
    margin: 0 auto 16px;
}

.rules-empty h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #1c1c1c;
}

.rules-empty p {
    color: #7c7c7c;
    font-size: 14px;
    margin: 0 0 24px 0;
}

/* ==================== MODERATOR TOOLS ==================== */

.mod-tools-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.mod-tools-header {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.mod-tools-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-primary);
}

.mod-tools-tabs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    border-bottom: 1px solid #edeff1;
}

.mod-tab {
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: #7c7c7c;
    cursor: pointer;
    transition: all 0.2s;
}

.mod-tab:hover {
    color: #1c1c1c;
}

.mod-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.mod-content {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 24px;
}

/* Mod Queue */
.mod-queue-item {
    padding: 16px;
    border: 1px solid #edeff1;
    border-radius: 8px;
    margin-bottom: 16px;
}

.mod-queue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.mod-queue-type {
    display: inline-block;
    padding: 4px 8px;
    background: #ff4444;
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.mod-queue-type.report {
    background: #ff4444;
}

.mod-queue-type.spam {
    background: #ff8800;
}

.mod-queue-type.pending {
    background: #0079d3;
}

.mod-queue-content {
    margin-bottom: 12px;
}

.mod-queue-title {
    font-size: 16px;
    font-weight: 600;
    color: #1c1c1c;
    margin: 0 0 8px 0;
}

.mod-queue-details {
    font-size: 14px;
    color: #7c7c7c;
}

.mod-queue-actions {
    display: flex;
    gap: 8px;
}

.mod-action-approve {
    background: #46d160;
    color: white;
}

.mod-action-remove {
    background: #ff4444;
    color: white;
}

.mod-action-ignore {
    background: #7c7c7c;
    color: white;
}

/* Mod Stats */
.mod-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.mod-stat-card {
    padding: 20px;
    background: #f6f7f8;
    border-radius: 8px;
}

.mod-stat-label {
    font-size: 12px;
    color: #7c7c7c;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 8px;
}

.mod-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1c1c1c;
}

.mod-stat-change {
    font-size: 12px;
    margin-top: 4px;
}

.mod-stat-change.positive {
    color: #46d160;
}

.mod-stat-change.negative {
    color: #ff4444;
}

/* Mod Log */
.mod-log-item {
    display: flex;
    gap: 16px;
    padding: 12px;
    border-bottom: 1px solid #edeff1;
}

.mod-log-item:last-child {
    border-bottom: none;
}

.mod-log-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #f6f7f8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mod-log-icon svg {
    width: 20px;
    height: 20px;
    stroke: #7c7c7c;
}

.mod-log-content {
    flex: 1;
}

.mod-log-action {
    font-size: 14px;
    color: #1c1c1c;
    margin-bottom: 4px;
}

.mod-log-moderator {
    font-weight: 600;
    color: #0079d3;
}

.mod-log-details {
    font-size: 12px;
    color: #7c7c7c;
}

/* ==================== MEMBER MANAGEMENT ==================== */

.members-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

.members-header {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.members-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text-primary);
}

.members-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.members-search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 14px;
}

.members-filters {
    display: flex;
    gap: 8px;
}

.member-filter-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: #7c7c7c;
    cursor: pointer;
    transition: all 0.2s;
}

.member-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.member-filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.members-list {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    border-bottom: 1px solid #edeff1;
    transition: background 0.2s;
}

.member-item:last-child {
    border-bottom: none;
}

.member-item:hover {
    background: #f8f9fa;
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.member-info {
    flex: 1;
}

.member-name {
    font-size: 14px;
    font-weight: 600;
    color: #1c1c1c;
    margin-bottom: 4px;
}

.member-name a {
    color: #1c1c1c;
    text-decoration: none;
}

.member-name a:hover {
    text-decoration: underline;
}

.member-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #7c7c7c;
}

.member-role {
    display: inline-block;
    padding: 2px 8px;
    background: #f6f7f8;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.member-role.owner {
    background: #ff4444;
    color: white;
}

.member-role.moderator {
    background: #46d160;
    color: white;
}

.member-role.member {
    background: #f6f7f8;
    color: #7c7c7c;
}

.member-actions {
    display: flex;
    gap: 8px;
}

.member-actions .btn {
    padding: 6px 12px;
    font-size: 13px;
}

/* Invite modal */
.invite-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.invite-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.invite-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #edeff1;
}

.invite-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.invite-modal-body {
    padding: 24px;
}

.invite-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 16px;
}

.invite-user-list {
    max-height: 300px;
    overflow-y: auto;
}

.invite-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
}

.invite-user-item:hover {
    background: #f6f7f8;
}

.invite-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #edeff1;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ==================== POST FLAIR SYSTEM ==================== */

.flair {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    margin-left: 8px;
    vertical-align: middle;
}

.flair-text {
    color: inherit;
}

/* Default flair styles */
.flair-default {
    background: #f6f7f8;
    color: #1c1c1c;
}

/* Custom flair colors */
.flair-red {
    background: #ffe5e5;
    color: #d93900;
}

.flair-orange {
    background: #fff3e0;
    color: #ff8800;
}

.flair-yellow {
    background: #fffde7;
    color: #ddaa00;
}

.flair-green {
    background: #e8f5e9;
    color: #46a049;
}

.flair-blue {
    background: #e3f2fd;
    color: #0079d3;
}

.flair-purple {
    background: #f3e5f5;
    color: #9c27b0;
}

/* Flair selector */
.flair-selector {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.flair-selector-label {
    font-size: 14px;
    font-weight: 600;
    color: #1c1c1c;
    margin-bottom: 12px;
}

.flair-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.flair-option {
    padding: 2px 6px;
    background: #f6f7f8;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.flair-option:hover {
    background: #edeff1;
}

.flair-option.selected {
    border-color: var(--primary);
    background: #e3f2fd;
}

/* Flair management (moderator) */
.flair-management {
    background: white;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 24px;
}

.flair-management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.flair-management-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.flair-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flair-list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border: 1px solid #edeff1;
    border-radius: 4px;
}

.flair-preview {
    flex-shrink: 0;
}

.flair-details {
    flex: 1;
}

.flair-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.flair-stats {
    font-size: 12px;
    color: #7c7c7c;
}

.flair-item-actions {
    display: flex;
    gap: 8px;
}

/* Flair editor modal */
.flair-editor {
    padding: 24px;
}

.flair-editor-field {
    margin-bottom: 20px;
}

.flair-editor-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1c1c1c;
}

.flair-editor-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.flair-color-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.flair-color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.flair-color-option:hover {
    transform: scale(1.1);
}

.flair-color-option.selected {
    border-color: #1c1c1c;
}

.flair-preview-box {
    padding: 16px;
    background: #f6f7f8;
    border-radius: 4px;
    text-align: center;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 768px) {
    .circle-rules-container,
    .mod-tools-container,
    .members-container {
        padding: 16px;
    }

    .rules-header,
    .mod-tools-header,
    .members-header,
    .rules-list,
    .mod-content,
    .members-list {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .rule-item,
    .member-item {
        padding: 16px;
    }

    .rule-description {
        margin-left: 0;
    }

    .rule-edit-form {
        margin-left: 0;
    }

    .mod-tools-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }

    .mod-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .members-search-bar {
        flex-direction: column;
    }

    .members-filters {
        overflow-x: auto;
        white-space: nowrap;
    }

    .member-item {
        flex-wrap: wrap;
    }

    .member-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .flair-color-picker {
        grid-template-columns: repeat(4, 1fr);
    }
}
