/* COMMUNITY-CT — Community page layout and styling
 * ===================================================================================
 * Dark theme matching the rest of ct-web.
 * Orange (#ff8c42) accents, flexbox layout, spring animations.
 * =================================================================================== */

/* --- Page Wrapper --- */

#community-page {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, #1a0a2e 0%, #0d0015 100%);
    padding: 20px;
    box-sizing: border-box;
}

.community-container {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 2px solid #ff8c42;
}

/* --- Header --- */

.community-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #ff8c42;
}

.community-back {
    color: #ff8c42;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.community-back:hover {
    background: rgba(255, 140, 66, 0.15);
}

.community-title {
    color: #ff8c42 !important;
    font-size: 28px;
    margin: 0;
    font-family: cursive;
}

.community-paws {
    font-size: 24px;
    animation: seesaw 2s ease-in-out infinite;
    display: inline-block;
    transform-origin: center bottom;
}

@keyframes seesaw {
    0% {
        transform: rotate(-15deg) translateY(0);
    }
    25% {
        transform: rotate(0deg) translateY(-4px);
    }
    50% {
        transform: rotate(15deg) translateY(0);
    }
    75% {
        transform: rotate(0deg) translateY(-4px);
    }
    100% {
        transform: rotate(-15deg) translateY(0);
    }
}

/* --- Username Toggle --- */

.community-username-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.community-username-input {
    flex: 1;
    min-width: 120px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #ff8c42;
    background: #16213e;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.community-username-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.3);
}

.community-username-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.community-anon-toggle {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid #ff8c42;
    background: transparent;
    color: #ff8c42;
    font-size: 13px;
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s;
    white-space: nowrap;
}

.community-anon-toggle:hover {
    background: #ff8c42;
    color: #fff;
}

/* --- Form --- */

.community-form-section {
    margin-bottom: 24px;
}

.community-form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.community-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #ff8c42;
    background: #16213e;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    min-width: 100px;
}

.community-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border-radius: 8px;
    border: 2px solid #ff8c42;
    background: #16213e;
    color: #fff;
    font-size: 14px;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.community-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.3);
}

.community-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.community-submit-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #ff8c42, #ff3c7f);
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.community-submit-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(255, 140, 66, 0.4);
}

.community-reply-indicator {
    display: none;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(255, 140, 66, 0.1);
    border-radius: 8px;
    color: #ff8c42;
    font-size: 13px;
    font-style: italic;
}

.community-cancel-reply {
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #ff5252;
    background: transparent;
    color: #ff5252;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.community-cancel-reply:hover {
    background: rgba(255, 82, 82, 0.15);
}

/* --- Community Agent — Floating Chat Widget --- */

.community-agent-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: sans-serif;
}

.community-agent-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #ff8c42;
    background: linear-gradient(135deg, #ff8c42, #ff3c7f);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 140, 66, 0.4);
    transition:
        transform 0.2s,
        box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}

.community-agent-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(255, 140, 66, 0.6);
}

.community-agent-toggle:active {
    transform: scale(0.95);
}

.community-agent-panel {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    max-height: 420px;
    background: #16213e;
    border: 2px solid #ff8c42;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: spring-bounce-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.community-agent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 140, 66, 0.15);
    border-bottom: 1px solid rgba(255, 140, 66, 0.3);
    color: #ff8c42;
    font-weight: bold;
    font-size: 14px;
}

.community-agent-close {
    background: transparent;
    border: none;
    color: #ff8c42;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.community-agent-close:hover {
    color: #ff3c7f;
}

.community-agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.community-agent-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 90%;
}

.community-agent-msg-bot {
    align-self: flex-start;
}

.community-agent-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.community-agent-avatar {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.community-agent-text {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}

.community-agent-msg-bot .community-agent-text {
    background: rgba(255, 140, 66, 0.15);
    color: #e0e0e0;
    border: 1px solid rgba(255, 140, 66, 0.2);
}

.community-agent-msg-user .community-agent-text {
    background: linear-gradient(135deg, #ff8c42, #ff3c7f);
    color: #fff;
}

.community-agent-input-row {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 140, 66, 0.2);
    background: rgba(0, 0, 0, 0.2);
}

.community-agent-input {
    flex: 1;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid #ff8c42;
    background: #0d0615;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.community-agent-input:focus {
    border-color: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.2);
}

.community-agent-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.community-agent-send {
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.community-agent-send:hover {
    transform: scale(1.05);
}

.community-agent-typing {
    font-style: italic;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    padding-left: 28px;
}

.community-feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.community-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 18px;
    font-style: italic;
}

/* --- Individual Post --- */

.community-post {
    background: rgba(22, 33, 62, 0.8);
    border: 1px solid rgba(255, 140, 66, 0.3);
    border-radius: 12px;
    padding: 16px;
    animation: spring-bounce-up 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.community-post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.community-post-user {
    color: #ff8c42;
    font-weight: bold;
    font-size: 14px;
}

.community-post-category {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* issue category gets red/danger style */
.community-post-category[data-cat="issue"],
.community-post-category:contains("issue") {
    background: rgba(255, 82, 82, 0.15);
    color: #ff5252;
}

.community-post-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-left: auto;
}

.community-post-content p {
    color: #e0e0e0;
    font-size: 15px;
    line-height: 1.6;
    margin: 8px 0;
}

.community-post-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.community-reply-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #4caf50;
    background: transparent;
    color: #4caf50;
    font-size: 13px;
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s;
}

.community-reply-btn:hover {
    background: #4caf50;
    color: #fff;
}

.community-delete-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 2px solid #ff5252;
    background: transparent;
    color: #ff5252;
    font-size: 13px;
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s;
}

.community-delete-btn:hover {
    background: #ff5252;
    color: #fff;
}

.community-edit-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid #ff8c42;
    background: transparent;
    color: #ff8c42;
    font-size: 13px;
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s;
}

.community-edit-btn:hover {
    background: #ff8c42;
    color: #fff;
}

/* --- Reply Header --- */

.community-reply-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

/* --- Replies --- */

.community-replies {
    margin-top: 12px;
    padding-left: 20px;
    border-left: 3px solid rgba(255, 140, 66, 0.3);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.community-reply {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
}

.community-reply-user {
    color: #4caf50;
    font-weight: bold;
    font-size: 13px;
}

.community-reply-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    margin-left: auto;
}

.community-reply-content {
    color: #ccc;
    font-size: 14px;
    line-height: 1.5;
    margin: 6px 0 8px;
}

.community-reply-delete {
    font-size: 12px;
    padding: 4px 10px;
}

/* --- Delete Confirmation Modal --- */

.community-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.community-modal-box {
    background: #16213e;
    border: 2px solid #ff8c42;
    border-radius: 16px;
    padding: 24px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    animation: spring-bounce-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.community-modal-msg {
    color: #e0e0e0;
    font-size: 16px;
    margin: 0 0 20px;
    line-height: 1.5;
}

.community-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.community-modal-cancel {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid #ff8c42;
    background: transparent;
    color: #ff8c42;
    font-size: 14px;
    cursor: pointer;
    transition:
        background 0.2s,
        color 0.2s;
}

.community-modal-cancel:hover {
    background: #ff8c42;
    color: #fff;
}

.community-modal-confirm {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #ff5252, #ff3c7f);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.community-modal-confirm:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(255, 82, 82, 0.4);
}
