/**
 * Forum by WebNavoz – Frontend Styles (v2.0)
 * Based on the original design, modernized and cleaned up
 */

/* === Main Container === */
.fbw-forum-main {
    margin: 20px 0;
    color: #5a4f6c;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

/* === Forum Item (Topic Row) === */
.fbw-forum-item {
    position: relative;
    padding: 18px 30px 18px 20px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none !important;
    box-shadow: none !important;
    outline: none !important;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #eef0f5;
}

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

.fbw-forum-item:nth-child(odd) {
    background-color: #f6f7fb;
}

.fbw-forum-item:nth-child(even) {
    background-color: #fff;
}

.fbw-forum-item:hover {
    background-color: #e8eaf0 !important;
}

/* Left side (thumbnail + title) */
.fbw-forum-itemleft {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0;
    padding-right: 20px;
    border-right: 1px solid #e0e4ed;
}

/* Thumbnail */
.fbw-forum-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.fbw-forum-nothumb {
    background-color: #e2e5ef;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.5'%3E%3Cpath d='M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z'/%3E%3C/svg%3E");
    background-size: 24px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Title */
.fbw-forum-title {
    color: #53597a;
    font-size: 18px;
    line-height: 1.3;
    font-weight: 500;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fbw-forum-item:hover .fbw-forum-title {
    color: #7b2d8e;
}

/* Right side (count) */
.fbw-forum-itemright {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 140px;
    flex-shrink: 0;
    padding-left: 20px;
}

.fbw-forum-count {
    color: #9798db;
    font-size: 36px;
    line-height: 1;
    font-weight: 300;
    min-width: 40px;
    text-align: right;
}

.fbw-forum-countlabel {
    font-size: 12px;
    color: #9da2b3;
    font-style: italic;
    line-height: 1.3;
}

/* Empty state */
.fbw-forum-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 8px;
}

/* === Load More Button === */
.fbw-loadmore-wrap {
    text-align: center;
    margin: 20px 0;
}

.fbw-loadmore-btn {
    display: inline-block;
    padding: 12px 30px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(90deg, #689ae3, #8f7bd7);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fbw-loadmore-btn:hover {
    opacity: 0.85;
}

.fbw-loadmore-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Create Topic Button === */
.fbw-forum-adddiv {
    text-align: center;
    margin: 20px 0;
}

.fbw-forum-addbutton {
    display: inline-block;
    padding: 16px 35px;
    font-size: 14px;
    line-height: 1;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(90deg, #689ae3, #8f7bd7);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.fbw-forum-addbutton:hover {
    background: #7e88dc;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(126, 136, 220, 0.3);
}

/* === Alerts === */
.fbw-alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.5;
}

.fbw-alert-success {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.fbw-alert-error {
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

/* === Form Wrapper === */
.fbw-forum-formwrap {
    width: 100%;
    margin: 15px 0;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
}

.fbw-forum-forminner {
    display: flex;
    gap: 15px;
    padding: 25px;
    background: #f6f7fb;
    border-radius: 8px;
}

/* Avatar */
.fbw-forum-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    flex-shrink: 0;
    background-color: #ddd;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    background-size: 28px;
    background-position: center;
    background-repeat: no-repeat;
}

/* Main Form */
.fbw-forum-mainform {
    flex: 1;
    min-width: 0;
}

.fbw-forum-mainform p {
    margin: 0 0 12px;
}

.fbw-forum-mainform input[type="text"],
.fbw-forum-mainform textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 16px;
    color: #333;
    background: #fff;
    border: 1px solid #d5dae7;
    border-radius: 6px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.fbw-forum-mainform input[type="text"]:focus,
.fbw-forum-mainform textarea:focus {
    border-color: #8f7bd7;
    box-shadow: 0 0 0 3px rgba(143, 123, 215, 0.15);
    outline: none;
}

.fbw-forum-mainform textarea {
    resize: vertical;
    min-height: 100px;
}

.fbw-file-input {
    font-size: 14px;
    color: #666;
}

/* Submit button */
.fbw-forum-sendp {
    text-align: center;
    margin-top: 15px;
}

.fbw-submit-btn {
    display: inline-block;
    padding: 14px 35px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(90deg, #689ae3, #8f7bd7);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fbw-submit-btn:hover {
    background: #7e88dc;
}

.fbw-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading overlay */
.fbw-forum-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: rgba(255,255,255,0.8);
    align-items: center;
    justify-content: center;
}

.fbw-forum-loading::after {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: #8f7bd7;
    border-radius: 50%;
    animation: fbw-spin 0.8s linear infinite;
}

.fbw-forum-loading.active {
    display: flex;
}

@keyframes fbw-spin {
    to { transform: rotate(360deg); }
}

/* === Responsive === */
@media screen and (max-width: 700px) {
    .fbw-forum-countlabel {
        display: none;
    }

    .fbw-forum-itemright {
        width: auto;
        padding-left: 15px;
    }

    .fbw-forum-itemleft {
        padding-right: 15px;
    }

    .fbw-forum-title {
        font-size: 16px;
    }

    .fbw-forum-count {
        font-size: 28px;
    }
}

@media screen and (max-width: 500px) {
    .fbw-forum-item {
        padding: 14px 15px;
    }

    .fbw-forum-itemright {
        display: none;
    }

    .fbw-forum-itemleft {
        border-right: none;
        padding-right: 0;
    }

    .fbw-forum-title {
        font-size: 15px;
    }

    .fbw-forum-forminner {
        flex-direction: column;
        padding: 15px;
    }

    .fbw-forum-avatar {
        display: none;
    }
}
