/* ============================================================
   AI Tools Reviews — Frontend Styles
   ============================================================ */

:root {
    --atr-star-color:   #F59E0B;
    --atr-star-empty:   #D1D5DB;
    --atr-text:         #111827;
    --atr-muted:        #6B7280;
    --atr-border:       #E5E7EB;
    --atr-bg:           #FFFFFF;
    --atr-bg-alt:       #F9FAFB;
    --atr-accent:       #2563EB;
    --atr-accent-hover: #1D4ED8;
    --atr-radius:       10px;
    --atr-shadow:       0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
}

/* ── Wrapper ── */
.atr-wrapper,
.atr-form-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--atr-text);
    max-width: 720px;
    margin: 40px 0;
}

/* ── Summary bar ── */
.atr-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--atr-bg-alt);
    border: 1px solid var(--atr-border);
    border-radius: var(--atr-radius);
    margin-bottom: 28px;
}

.atr-big-rating {
    font-size: 52px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -2px;
    color: var(--atr-text);
}

.atr-out-of {
    font-size: 20px;
    color: var(--atr-muted);
    font-weight: 500;
    margin-left: 2px;
}

.atr-summary-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.atr-count {
    font-size: 13px;
    color: var(--atr-muted);
}

/* ── Stars display ── */
.atr-stars-display,
.atr-review-stars {
    display: flex;
    gap: 2px;
}

.atr-star {
    display: inline-flex;
    width: 20px;
    height: 20px;
}

.atr-star svg {
    width: 100%;
    height: 100%;
}

.atr-star--full  svg { fill: var(--atr-star-color); stroke: var(--atr-star-color); }
.atr-star--empty svg { fill: var(--atr-star-empty); stroke: var(--atr-star-empty); }
.atr-star--half  { position: relative; overflow: hidden; }
.atr-star--half svg { fill: var(--atr-star-empty); stroke: var(--atr-star-empty); }
.atr-star--half::after {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 50%; height: 100%;
    background: var(--atr-star-color);
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* ── Review cards ── */
.atr-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
}

.atr-review-card {
    background: var(--atr-bg);
    border: 1px solid var(--atr-border);
    border-radius: var(--atr-radius);
    padding: 20px 24px;
    box-shadow: var(--atr-shadow);
    transition: box-shadow .2s;
}

.atr-review-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.08);
}

.atr-review-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.atr-reviewer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--atr-accent);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.atr-reviewer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.atr-reviewer-name {
    font-size: 14px;
    font-weight: 600;
}

.atr-review-date {
    font-size: 12px;
    color: var(--atr-muted);
}

.atr-review-stars {
    margin-left: auto;
}

.atr-review-stars .atr-star {
    width: 16px;
    height: 16px;
}

.atr-review-body {
    font-size: 14px;
    line-height: 1.7;
    color: #374151;
    margin: 0;
}

.atr-no-reviews {
    text-align: center;
    color: var(--atr-muted);
    padding: 32px;
    border: 1px dashed var(--atr-border);
    border-radius: var(--atr-radius);
    margin-bottom: 32px;
}

/* ── Form ── */
.atr-form-wrapper {
    border-top: 1px solid var(--atr-border);
    padding-top: 32px;
}

.atr-form-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 24px;
}

.atr-field {
    margin-bottom: 20px;
}

.atr-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .atr-field-row { grid-template-columns: 1fr; }
}

.atr-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--atr-text);
}

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

.atr-input,
.atr-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1.5px solid var(--atr-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--atr-text);
    background: var(--atr-bg);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    font-family: inherit;
}

.atr-input:focus,
.atr-textarea:focus {
    border-color: var(--atr-accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.atr-textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

/* ── Star picker ── */
.atr-star-picker {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.atr-star-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 40px;
    height: 40px;
    color: var(--atr-star-empty);
    transition: color .1s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.atr-star-btn:hover,
.atr-star-btn.atr-hovered,
.atr-star-btn.atr-selected {
    color: var(--atr-star-color);
    transform: scale(1.15);
}

.atr-star-btn svg {
    width: 28px;
    height: 28px;
    transition: fill .1s;
}

.atr-star-btn.atr-selected svg,
.atr-star-btn.atr-hovered svg {
    fill: var(--atr-star-color);
}

.atr-rating-label-text {
    font-size: 13px;
    color: var(--atr-muted);
    font-style: italic;
    min-height: 18px;
    display: block;
}

/* ── Toggle ── */
.atr-field-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}

.atr-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.atr-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.atr-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--atr-border);
    border-radius: 24px;
    cursor: pointer;
    transition: background .2s;
}

.atr-toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px; top: 3px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .2s;
}

.atr-toggle input:checked + .atr-toggle-slider {
    background: var(--atr-accent);
}

.atr-toggle input:checked + .atr-toggle-slider::before {
    transform: translateX(20px);
}

.atr-toggle-label {
    font-size: 13px;
    color: #4B5563;
    line-height: 1.5;
}

/* ── Submit button ── */
.atr-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background:linear-gradient(135deg, #7A3ECB, #58A2E1);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, transform .1s;
    font-family: inherit;
    margin-top: 8px;
}

.atr-submit-btn:hover {
    background: linear-gradient(135deg, #7A3ECB, #58A2E1)
    transform: translateY(-1px);
}

.atr-submit-btn:active {
    transform: translateY(0);
}

.atr-submit-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
.atr-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: atr-spin .7s linear infinite;
}

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

/* ── Notices ── */
.atr-success-message,
.atr-error-message {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
}

.atr-success-message {
    background: #D1FAE5;
    border: 1px solid #6EE7B7;
    color: #065F46;
}

.atr-error-message {
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    color: #991B1B;
}
