@import url('global.css');

.listing-container {
    width: 90%;
    max-width: 600px;
    margin: 0 auto;
    margin-top: 3rem;
    margin-bottom: 3rem;
    background-color: var(--nav-bg-color);
    border-radius: 1rem;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* NSFW Border */
.listing-container.nsfw {
    border: 2px solid var(--danger-color);
}

.listing-header {
    text-align: center;
    margin-bottom: 30px;
}

.listing-header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
    margin-top: 0;
}

.listing-header p {
    color: var(--secondary-text-color);
    font-size: 1rem;
    margin: 0;
}

.listing-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* This targets the Django inputs we attached the 'formControl' class to in JS */
.form-control,
#serverSelector {
    background-color: var(--bg-color);
    border: 2px solid transparent;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    padding: 12px 15px;
    border-radius: 8px;
    outline: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-control:focus,
#serverSelector:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgb(from var(--primary-color) r g b / 0.2);
}

.form-control::placeholder {
    color: #666;
}

select.form-control option,
#serverSelector option {
    background-color: var(--nav-bg-color);
    color: var(--text-color);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-error-note {
    color: var(--danger-color, #ff4757);
    font-size: 0.85rem;
    margin-top: 2px;
    margin-bottom: 0px;
    font-weight: 500;
    line-height: 1.2;
}

/* Custom Checkbox Styling for NSFW */
.nsfw-checkbox-container {
    display: block;
    width: 100%;
}

.nsfw-checkbox-container input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 48px;
    background-color: var(--primary-color);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    margin: 0;
    display: block;
    box-sizing: border-box;
}

.nsfw-checkbox-container input[type="checkbox"]:checked {
    background-color: var(--danger-color);
}

.nsfw-checkbox-container input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: var(--text-color);
    font-size: 24px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.nsfw-checkbox-container input[type="checkbox"]:hover {
    box-shadow: 0 0 10px rgb(from var(--primary-color) r g b / 0.4);
}

.nsfw-checkbox-container input[type="checkbox"]:checked:hover {
    box-shadow: 0 0 10px rgb(from var(--danger-color) r g b / 0.4);
}

/* Submit Button */
.submit-btn {
    background-color: var(--primary-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.submit-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 15px rgb(from var(--primary-color) r g b / 0.4);
    transform: translateY(-2px);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .listing-container {
        width: 90%;
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Tag Input System */
.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background-color: var(--bg-color);
    border: 2px solid transparent;
    padding: 8px 12px;
    border-radius: 8px;
    min-height: 48px;
    align-items: center;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: text;
}

.tag-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgb(from var(--primary-color) r g b / 0.2);
}

.tag-dummy-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 1rem;
    font-family: inherit;
    min-width: 200px;
}

.tag-dummy-input::placeholder {
    color: #666;
}

.tag-pill {
    background-color: transparent;
    color: #fff;
    padding: 5px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 2px solid var(--primary-color);
}

.tag-pill .tag-emoji {
    font-size: 0.85rem;
    line-height: 1;
}

.tag-close {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
}

.tag-close:hover {
    color: #fff;
}

/* Edit Listing Specific Structural Formats */
.edit-row-1 {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}

.col-1-image {
    display: flex;
    flex-direction: column;
    width: 20%;
    flex-shrink: 0;
}

.col-1-image img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    background: var(--bg-tertiary, #1e1f22);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.col-2-fields {
    width: 80%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
}

.actions-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.actions-row .submit-btn {
    width: 100%;
}

.btn-visibility {
    width: 100%;
    background-color: transparent;
    border: 1px solid var(--text-color);
    color: var(--text-color);
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
    font-weight: bold;
}

.btn-visibility:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
}

.delete-listing-text {
    color: #ff4757;
    text-decoration: underline;
    font-size: 0.95em;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    /* Explicit parameter */
}

.delete-listing-text:hover {
    opacity: 1;
}

@media (max-width: 768px) {
    .edit-row-1 {
        flex-direction: column;
    }

    .col-1-image {
        width: 100%;
        max-width: 150px;
        margin: 0 auto 20px auto;
    }

    .col-2-fields {
        width: 100%;
    }
}

/* Listing View Specific */
.view-container {
    max-width: 800px;
    padding: 50px;
}

.view-header-row {
    display: flex;
    gap: 40px;
    align-items: center;
}

.view-img-col {
    width: 180px;
    flex-shrink: 0;
}

.view-img-col img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.view-info-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.view-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    color: var(--text-color);
}

.view-subtitle {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}

.member-counter-pill {
    display: inline-flex;
    align-items: center;
    background-color: #2B2B2B;
    border-radius: 50px;
    font-size: 1.15rem;
    font-weight: 500;
    color: #ffffff;
    width: fit-content;
    margin-bottom: 5px;
}

.member-counter-pill .member-count {
    padding: 6px 18px;
    position: relative;
    z-index: 3;
}

.member-counter-pill .online-count {
    background-color: var(--primary-color);
    padding: 6px 18px;
    border-radius: 50px;
    color: #ffffff;
    font-weight: 600;
    position: relative;
    z-index: 2;
}

.member-counter-pill .bump-count {
    background-color: var(--fluxer-color);
    padding: 6px 18px 6px 36px;
    border-radius: 50px;
    color: #ffffff;
    font-weight: 600;
    position: relative;
    z-index: 1;
    margin-left: -24px;
}

.view-actions-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.view-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    margin-top: 0;
    text-decoration: none;
}

.view-invite-btn {
    background-color: var(--primary-color) !important;
    padding: 15px 30px;
}

.view-invite-btn:hover {
    box-shadow: 0 0 15px rgb(from var(--primary-color) r g b / 0.4) !important;
}

.view-bump-btn {
    background-color: var(--fluxer-color) !important;
    padding: 15px 30px;
}

.view-bump-btn:hover {
    box-shadow: 0 0 15px rgb(from var(--fluxer-color) r g b / 0.4) !important;
}

.view-website-btn {
    background-color: transparent !important;
    border: 2px solid var(--text-color);
    color: var(--text-color);
    padding: 13px 28px;
}

.view-website-btn:hover {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4) !important;
    background-color: transparent !important;
}

.view-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

@media (max-width: 768px) {
    .view-header-row {
        flex-direction: column;
        text-align: center;
    }

    .view-img-col {
        width: 150px;
    }

    .view-tags {
        justify-content: center;
    }
}

/* Report Element Styles */
.report-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-color);
    border: 2px solid transparent;
    color: var(--secondary-text-color);
    border-radius: 8px;
    height: 40px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    font-weight: 600;
}

.report-btn:hover:not(.reported) {
    color: var(--danger-color);
    border-color: var(--danger-color);
    box-shadow: 0 0 12px var(--danger-color);
}

.report-btn.reported {
    cursor: default;
    color: var(--danger-color);
    background: transparent;
    border-color: transparent;
    opacity: 0.8;
}

.report-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.75);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.report-modal-content {
    background-color: var(--nav-bg-color);
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
}

.report-modal-title {
    margin-top: 0;
    color: var(--danger-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.report-modal-desc {
    color: var(--secondary-text-color);
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.report-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 24px;
}

.report-modal-actions .btn-visibility {
    width: auto;
    padding: 10px 24px;
}

.report-modal-actions .report-submit {
    margin-top: 0;
    width: auto;
    padding: 10px 24px;
    background-color: var(--danger-color);
}

.report-modal-actions .report-submit:hover {
    filter: brightness(1.2);
}