/**
 * Bubble Reviews — Form Stylesheet
 * v0.01
 */

/* ==========================================================================
   1. Inline Form Section
   ========================================================================== */

.br-form-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--br-border);
}

.br-form-section__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--br-text);
    margin: 0 0 24px;
}

/* ==========================================================================
   2. Modal / Popup
   ========================================================================== */

.br-form-modal {
    position: fixed;
    inset: 0;
    display: none; /* Hidden by default — JS toggles via style.display */
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.br-form-modal.br-active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.br-form-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.br-form-modal__container {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: var(--br-bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    animation: br-slideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    margin: 16px;
}

@keyframes br-slideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.br-form-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--br-border);
    flex-shrink: 0;
}

.br-form-modal__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--br-text);
    margin: 0;
}

.br-form-modal__close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--br-text-muted);
    font-size: 20px;
    transition: background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}

.br-form-modal__close:hover {
    background: var(--br-bg-section);
    color: var(--br-text);
}

.br-form-modal__body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

body.br-modal-open {
    overflow: hidden;
}

/* ==========================================================================
   3. Star Selector
   ========================================================================== */

.br-star-selector {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
}

.br-star-selector__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--br-text);
    margin-bottom: 8px;
    display: block;
}

.br-star-selector__stars {
    display: inline-flex;
    gap: 4px;
}

.br-star-selector__btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    transition: transform 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.br-star-selector__btn:hover {
    transform: scale(1.2);
}

.br-star-selector__btn svg {
    width: 32px;
    height: 32px;
    fill: var(--br-star-empty);
    transition: fill 0.15s ease;
}

.br-star-selector__btn.br-selected svg,
.br-star-selector__btn.br-hovered svg {
    fill: var(--br-star);
}

.br-star-selector__text {
    font-size: 13px;
    color: var(--br-text-muted);
    margin-left: 12px;
    font-weight: 500;
    min-width: 80px;
}

/* ==========================================================================
   4. Form Fields
   ========================================================================== */

.br-form__group {
    margin-bottom: 18px;
}

.br-form__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--br-text);
    margin-bottom: 6px;
}

.br-form__label .br-required {
    color: #EF4444;
    margin-left: 2px;
}

.br-form__input,
.br-form__textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--br-font);
    color: var(--br-text);
    background: var(--br-bg-card);
    border: 1.5px solid var(--br-border);
    border-radius: calc(var(--br-radius) / 2);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.br-form__input:focus,
.br-form__textarea:focus {
    outline: none;
    border-color: var(--br-primary);
    box-shadow: 0 0 0 3px rgba(155, 125, 204, 0.15);
}

.br-form__input::placeholder,
.br-form__textarea::placeholder {
    color: var(--br-text-muted);
    opacity: 0.6;
}

.br-form__textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.br-form__row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* ==========================================================================
   5. Dropzone
   ========================================================================== */

.br-dropzone {
    position: relative;
    border: 2px dashed var(--br-border);
    border-radius: calc(var(--br-radius) / 2);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.br-dropzone:hover {
    border-color: var(--br-primary);
}

.br-dropzone.br-drag-over {
    border-color: var(--br-primary);
    background: rgba(155, 125, 204, 0.05);
}

.br-dropzone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.br-dropzone__icon {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.br-dropzone__icon svg {
    width: 32px;
    height: 32px;
    fill: var(--br-text-muted);
    opacity: 0.5;
}

.br-dropzone__text {
    font-size: 14px;
    font-weight: 500;
    color: var(--br-text-muted);
    margin-bottom: 4px;
}

.br-dropzone__text strong {
    color: var(--br-primary);
}

.br-dropzone__hint {
    font-size: 12px;
    color: var(--br-text-muted);
    opacity: 0.7;
}

/* ==========================================================================
   6. Dropzone Preview
   ========================================================================== */

.br-dropzone__preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.br-dropzone__thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.br-dropzone__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.br-dropzone__thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s ease;
}

.br-dropzone__thumb-remove:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* ==========================================================================
   7. Upload Spinner
   ========================================================================== */

.br-dropzone__thumb--uploading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.br-dropzone__thumb--uploading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--br-border);
    border-top-color: var(--br-primary);
    border-radius: 50%;
    z-index: 1;
    animation: br-spin 0.7s linear infinite;
}

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

/* Pulse animation on the container while uploading */
.br-dropzone--uploading {
    animation: br-pulse 1.5s ease infinite;
}

@keyframes br-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ==========================================================================
   8. Submit Button
   ========================================================================== */

.br-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--br-font);
    color: #FFFFFF;
    background: linear-gradient(135deg, var(--br-primary), var(--br-primary-hover));
    border: none;
    border-radius: calc(var(--br-radius) / 2);
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(155, 125, 204, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    margin-top: 8px;
}

.br-form__submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(155, 125, 204, 0.45);
}

.br-form__submit:active {
    transform: translateY(0);
}

.br-form__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.br-form__submit .br-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: br-spin 0.7s linear infinite;
}

.br-form__submit.br-loading .br-spinner {
    display: inline-block;
}

.br-form__submit.br-loading .br-form__submit-text {
    display: none;
}

/* ==========================================================================
   9. Login Notice
   ========================================================================== */

.br-login-notice {
    background: var(--br-bg-section);
    border-radius: calc(var(--br-radius) / 2);
    padding: 20px 24px;
    text-align: center;
    font-size: 14px;
    line-height: 1.6;
    color: var(--br-text-muted);
}

.br-login-notice a {
    color: var(--br-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.br-login-notice a:hover {
    color: var(--br-primary-hover);
    text-decoration: underline;
}

/* ==========================================================================
   10. Responsive
   ========================================================================== */

@media (max-width: 600px) {
    .br-form-modal__container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .br-form-modal__body {
        padding: 18px;
    }

    .br-form__row {
        grid-template-columns: 1fr;
    }

    .br-star-selector__btn svg {
        width: 28px;
        height: 28px;
    }

    .br-dropzone {
        padding: 18px;
    }
}

/* ==========================================================================
   11. Star Rating — hover & active fill
   ========================================================================== */

.br-star-selector__star {
    fill: var(--br-star-empty, #E5E7EB);
    transition: fill 0.15s ease;
    cursor: pointer;
}

.br-star-selector__star--active {
    fill: #F59E0B;
}

.br-star-selector__stars:hover .br-star-selector__star {
    fill: #F59E0B;
}

.br-star-selector__star:hover ~ .br-star-selector__star {
    fill: var(--br-star-empty, #E5E7EB);
}

/* Star Rating Interactive Styles */
.br-star-selector__btn {
    cursor: pointer;
    transition: transform 0.15s ease;
    background: none;
    border: none;
    padding: 2px;
}
.br-star-selector__btn:hover {
    transform: scale(1.2);
}
.br-star-selector__btn svg {
    fill: var(--br-star-empty, #E5E7EB);
    stroke: none;
    width: 32px;
    height: 32px;
    transition: fill 0.15s ease;
}
.br-star-selector__stars:hover .br-star-selector__btn svg {
    fill: var(--br-star, #F59E0B);
}
.br-star-selector__stars .br-star-selector__btn:hover ~ .br-star-selector__btn svg {
    fill: var(--br-star-empty, #E5E7EB);
}
.br-star-selector__btn.br-star-selector__star--active svg {
    fill: var(--br-star, #F59E0B) !important;
}
