/**
 * Review Starter - Frontend Styles
 */

/* ==============================
   CSS Custom Properties
   ============================== */
:root {
    --rvst-primary: #2563eb;
    --rvst-primary-hover: #1d4ed8;
    --rvst-star-color: #f59e0b;
    --rvst-star-empty: #d1d5db;
    --rvst-text: #1f2937;
    --rvst-text-light: #6b7280;
    --rvst-bg: #ffffff;
    --rvst-bg-alt: #f9fafb;
    --rvst-border: #e5e7eb;
    --rvst-radius: 12px;
    --rvst-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --rvst-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --rvst-success: #059669;
    --rvst-error: #dc2626;
}

/* ==============================
   Review Cards Grid
   ============================== */
.rvst-reviews-grid {
    display: grid;
    gap: 24px;
    margin: 2em 0;
}

.rvst-cols-1 { grid-template-columns: 1fr; }
.rvst-cols-2 { grid-template-columns: repeat(2, 1fr); }
.rvst-cols-3 { grid-template-columns: repeat(3, 1fr); }
.rvst-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .rvst-cols-3,
    .rvst-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .rvst-cols-2,
    .rvst-cols-3,
    .rvst-cols-4 { grid-template-columns: 1fr; }
}

/* ==============================
   Review Card
   ============================== */
.rvst-review-card {
    background: var(--rvst-bg);
    border: 1px solid var(--rvst-border);
    border-radius: var(--rvst-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
}

.rvst-review-card:hover {
    box-shadow: var(--rvst-shadow-lg);
    transform: translateY(-2px);
}

/* Card Header */
.rvst-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rvst-card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--rvst-primary), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rvst-card-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rvst-card-initials {
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.rvst-card-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rvst-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--rvst-text);
    line-height: 1.3;
}

.rvst-card-name a {
    color: var(--rvst-text);
    text-decoration: none;
}

.rvst-card-name a:hover {
    color: var(--rvst-primary);
}

.rvst-card-company {
    font-size: 13px;
    color: var(--rvst-text-light);
    line-height: 1.3;
}

/* Stars */
.rvst-card-rating {
    display: flex;
    align-items: center;
}

.rvst-stars {
    display: inline-flex;
    gap: 2px;
}

.rvst-star {
    display: inline-block;
    vertical-align: middle;
}

.rvst-star-filled {
    color: var(--rvst-star-color);
}

.rvst-star-empty {
    color: var(--rvst-star-empty);
}

/* Message */
.rvst-card-message {
    flex: 1;
}

.rvst-card-message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--rvst-text);
}

/* Footer */
.rvst-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--rvst-border);
    gap: 8px;
}

.rvst-card-date {
    font-size: 12px;
    color: var(--rvst-text-light);
}

.rvst-card-service {
    font-size: 11px;
    font-weight: 500;
    color: var(--rvst-primary);
    background: rgba(37, 99, 235, 0.08);
    padding: 3px 10px;
    border-radius: 100px;
    white-space: nowrap;
}

/* No Reviews */
.rvst-no-reviews {
    text-align: center;
    color: var(--rvst-text-light);
    padding: 3em 1em;
    font-size: 15px;
}

/* ==============================
   Summary
   ============================== */
.rvst-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--rvst-bg);
    border: 1px solid var(--rvst-border);
    border-radius: var(--rvst-radius);
    margin: 1em 0;
}

.rvst-summary-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rvst-summary-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--rvst-text);
    line-height: 1;
}

.rvst-summary-count {
    font-size: 14px;
    color: var(--rvst-text-light);
}

/* ==============================
   Review Form
   ============================== */
.rvst-form-wrapper {
    max-width: 680px;
    margin: 2em auto;
}

.rvst-review-form {
    background: var(--rvst-bg);
    border: 1px solid var(--rvst-border);
    border-radius: var(--rvst-radius);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rvst-form-row {
    display: flex;
    gap: 16px;
}

@media (max-width: 640px) {
    .rvst-form-row {
        flex-direction: column;
    }
}

.rvst-form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rvst-form-field-full {
    flex-basis: 100%;
}

.rvst-form-field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--rvst-text);
}

.rvst-required {
    color: var(--rvst-error);
}

.rvst-form-field input[type="text"],
.rvst-form-field input[type="email"],
.rvst-form-field input[type="url"],
.rvst-form-field select,
.rvst-form-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--rvst-border);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--rvst-text);
    background: var(--rvst-bg);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.rvst-form-field input:focus,
.rvst-form-field select:focus,
.rvst-form-field textarea:focus {
    outline: none;
    border-color: var(--rvst-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

/* Star Rating Input */
.rvst-star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}

.rvst-star-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.rvst-star-label {
    cursor: pointer;
    transition: transform 0.15s ease;
}

.rvst-star-label svg {
    fill: var(--rvst-star-empty);
    stroke: none;
    transition: fill 0.15s ease;
}

.rvst-star-label:hover svg,
.rvst-star-label:hover ~ .rvst-star-label svg {
    fill: var(--rvst-star-color);
}

.rvst-star-input:checked ~ .rvst-star-label svg {
    fill: var(--rvst-star-color);
}

.rvst-star-label:hover {
    transform: scale(1.15);
}

/* Checkbox */
.rvst-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--rvst-text);
    cursor: pointer;
}

.rvst-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--rvst-primary);
}

/* Honeypot */
.rvst-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    overflow: hidden;
}

/* Submit Button */
.rvst-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    background: var(--rvst-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    width: 100%;
}

.rvst-submit-btn:hover {
    background: var(--rvst-primary-hover);
}

.rvst-submit-btn:active {
    transform: scale(0.98);
}

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

.rvst-submit-btn .rvst-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: rvst-spin 0.6s linear infinite;
}

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

/* Form Message */
.rvst-form-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.rvst-form-message.rvst-success {
    background: rgba(5, 150, 105, 0.08);
    color: var(--rvst-success);
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.rvst-form-message.rvst-error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--rvst-error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* ==============================
   Frontend Info Tooltips
   ============================== */
.rvst-form-wrapper .rvst-tooltip-wrap {
    display: inline-flex;
    align-items: center;
    position: relative;
    vertical-align: middle;
    margin-left: 4px;
}

.rvst-form-wrapper .rvst-tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--rvst-text-light);
    transition: color 0.15s ease;
    border-radius: 50%;
}

.rvst-form-wrapper .rvst-tooltip-trigger:hover,
.rvst-form-wrapper .rvst-tooltip-trigger:focus {
    color: var(--rvst-primary);
    outline: none;
}

.rvst-form-wrapper .rvst-tooltip-trigger svg {
    display: block;
}

.rvst-form-wrapper .rvst-tooltip-content {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--rvst-text);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 400;
    width: 240px;
    max-width: 80vw;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    pointer-events: none;
    text-align: left;
}

.rvst-form-wrapper .rvst-tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--rvst-text);
}

.rvst-form-wrapper .rvst-tooltip-wrap:hover .rvst-tooltip-content,
.rvst-form-wrapper .rvst-tooltip-trigger:focus + .rvst-tooltip-content,
.rvst-form-wrapper .rvst-tooltip-wrap.rvst-tooltip-active .rvst-tooltip-content {
    display: block;
}
