@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');

/* ── Language / Direction ────────────────────────────── */
.crp-lang-ar { direction: rtl; text-align: right; }
.crp-lang-ar .crp-back-btn,
.crp-lang-ar .crp-step p,
.crp-lang-ar .crp-step h2 { text-align: right; }

.crp-lang-en { direction: ltr; text-align: left; }
.crp-lang-en .crp-back-btn,
.crp-lang-en .crp-step p,
.crp-lang-en .crp-step h2 { text-align: left; }

/* ── Clinic Header ───────────────────────────────────── */
.crp-clinic-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 1.5rem; padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.crp-clinic-logo {
    width: 52px; height: 52px; object-fit: contain;
    border-radius: 10px; border: 1px solid var(--border);
    padding: 4px; background: white; flex-shrink: 0;
}
.crp-clinic-meta { display: flex; flex-direction: column; gap: 2px; }
.crp-clinic-name { font-size: 1.05rem; font-weight: 700; color: var(--text-dark); font-family: 'Cairo', sans-serif; }
.crp-clinic-location { font-size: 0.85rem; color: var(--text-light); font-family: 'Cairo', sans-serif; }

/* ── Container ───────────────────────────────────────── */
.crp-container {
    --primary: #0066CC; --success: #10B981; --warning: #F59E0B;
    --danger: #EC4899; --text-dark: #1E293B; --text-light: #6B7280;
    --border: #E5E7EB; --bg-light: #F0F7FF;
    position: relative;
    background: linear-gradient(135deg, var(--bg-light) 0%, #FFFFFF 100%);
    border-radius: 12px; padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,102,204,0.1);
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-dark); max-width: 600px; margin: 0 auto;
    width: 100%; box-sizing: border-box;
}

/* ── Loading Overlay ─────────────────────────────────── */
.crp-loader-overlay {
    position: absolute; inset: 0;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    z-index: 100; animation: fadeIn 0.2s ease;
}
.crp-loader-box { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.crp-loader-spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: crp-spin 0.8s linear infinite;
}
@keyframes crp-spin { to { transform: rotate(360deg); } }
.crp-loader-text {
    font-size: 0.95rem; font-weight: 600; color: var(--primary);
    margin: 0; font-family: 'Cairo', sans-serif;
}

/* ── Steps ───────────────────────────────────────────── */
.crp-step { display: none; opacity: 0; animation: slideIn 0.3s ease forwards; width: 100%; }
.crp-step.active { display: block; opacity: 1; }
@keyframes slideIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.crp-content { width: 100%; }
.crp-step h2 { font-size: 1.75rem; font-weight: 700; margin: 0 0 0.5rem; color: var(--text-dark); word-wrap: break-word; }
.crp-step p  { font-size: 1rem; color: var(--text-light); margin: 0 0 1.5rem; word-wrap: break-word; }

/* ── Back Button ─────────────────────────────────────── */
.crp-back-btn {
    background: none; border: none; color: var(--primary);
    font-weight: 600; cursor: pointer; padding: 0.5rem 0;
    margin-bottom: 1rem; transition: color 0.3s ease; font-size: 0.95rem;
}
.crp-back-btn:hover { color: var(--text-dark); }

/* ── Buttons Container ───────────────────────────────── */
.crp-buttons { display: flex; gap: 1rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* Step 1 — positive (last in HTML) on top via column-reverse on mobile */
.crp-buttons-step1 { flex-direction: row; }

/* ── Button Base ─────────────────────────────────────── */
.crp-btn {
    padding: 0.75rem 1.5rem; border: none; border-radius: 8px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: all 0.3s ease; flex: 1; min-width: 140px;
    display: flex; align-items: center; justify-content: center;
    gap: 0.5rem; text-align: center; white-space: normal;
    word-wrap: break-word; line-height: 1.4; font-family: 'Cairo', sans-serif;
}
.crp-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.crp-btn:active { transform: scale(0.98); }

.crp-btn-positive, .crp-btn-primary, .crp-btn-success {
    background: linear-gradient(135deg, var(--primary) 0%, var(--success) 100%); color: white;
}
.crp-btn-positive:hover, .crp-btn-primary:hover, .crp-btn-success:hover {
    transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0,102,204,0.3);
}
.crp-btn-negative {
    background: linear-gradient(135deg, var(--warning) 0%, var(--danger) 100%); color: white;
}
.crp-btn-negative:hover { transform: translateY(-2px); box-shadow: 0 8px 16px rgba(245,158,11,0.3); }
.crp-btn-secondary { background: white; color: var(--text-dark); border: 2px solid var(--border); }
.crp-btn-secondary:hover { border-color: var(--primary); background: var(--bg-light); }

/* ── Keywords ────────────────────────────────────────── */
.crp-keywords {
    display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem;
    padding: 1rem; background: white; border-radius: 8px;
    border: 1px solid var(--border); max-height: 300px; overflow-y: auto;
}
.crp-keyword {
    padding: 0.5rem 1rem; border: 2px solid var(--border);
    background: white; border-radius: 20px; cursor: pointer;
    transition: all 0.3s ease; font-size: 0.875rem; font-weight: 500;
    color: var(--text-dark); white-space: nowrap; font-family: 'Cairo', sans-serif;
}
.crp-keyword:hover { border-color: var(--primary); background: var(--bg-light); transform: translateY(-2px); }
.crp-keyword.selected { background: var(--primary); color: white; border-color: var(--primary); transform: scale(1.05); }

/* ── Review Box ──────────────────────────────────────── */
.crp-review-box {
    background: linear-gradient(135deg, var(--bg-light) 0%, white 100%);
    border: 2px solid var(--success); border-radius: 8px;
    padding: 1.5rem; min-height: 150px; height: auto; overflow: visible;
    display: flex; flex-direction: column; margin-bottom: 1.5rem;
    line-height: 1.8; font-size: 1rem; color: var(--text-dark);
    width: 100%; box-sizing: border-box;
    word-wrap: break-word; overflow-wrap: break-word; font-family: 'Cairo', sans-serif;
}
.crp-review-box > div { width: 100%; }
.crp-review-box p {
    margin: 0; color: var(--text-dark); width: 100%;
    word-wrap: break-word; white-space: normal; font-size: 1rem; line-height: 1.8;
}
.crp-review-box p[dir="rtl"], .crp-review-box p.rtl-text { direction: rtl; text-align: right; unicode-bidi: embed; }
.crp-review-box p:not([dir="rtl"]):not(.rtl-text) { direction: ltr; text-align: left; }
.crp-review-box small {
    font-size: 0.85rem; margin-bottom: 10px; color: #999;
    display: block; width: 100%; direction: ltr; text-align: left;
}

/* ── Complaint Thank-You (Step 4) ────────────────────── */
.crp-complaint-thanks { text-align: center; padding: 1rem 0; }
.crp-thanks-icon { font-size: 4rem; margin-bottom: 1rem; animation: bounceIn 0.6s ease; }
@keyframes bounceIn {
    0%  { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    70% { transform: scale(0.95); }
    100%{ transform: scale(1); opacity: 1; }
}
.crp-complaint-thanks h2 { color: var(--primary); margin-bottom: 0.75rem; }
.crp-complaint-thanks p { font-size: 1rem; line-height: 1.7; color: var(--text-light); max-width: 380px; margin: 0 auto 1.5rem; }
.crp-complaint-thanks .crp-btn-secondary { display: inline-flex; flex: none; width: auto; min-width: 160px; }

/* ── Animations ──────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Responsive 768px ────────────────────────────────── */
@media (max-width: 768px) {
    .crp-container { padding: 1.5rem; width: 100%; }
    .crp-step h2   { font-size: 1.5rem; }
    .crp-buttons   { flex-direction: column-reverse; }
    .crp-buttons-step1 { flex-direction: column-reverse; }
    .crp-btn { width: 100%; flex: none; min-width: auto; padding: 0.75rem 1rem; }
    .crp-review-box { padding: 1.25rem; min-height: 120px; }
    .crp-review-box p { font-size: 0.95rem; line-height: 1.6; }
}

/* ── Responsive 480px ────────────────────────────────── */
@media (max-width: 480px) {
    .crp-container { padding: 1rem; border-radius: 8px; }
    .crp-step h2   { font-size: 1.25rem; }
    .crp-step p    { font-size: 0.9rem; }
    .crp-buttons   { flex-direction: column-reverse; }
    .crp-buttons-step1 { flex-direction: column-reverse; }
    .crp-btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
    .crp-review-box { padding: 1rem; min-height: 100px; }
    .crp-review-box p { font-size: 0.9rem; line-height: 1.5; }
    .crp-keyword { white-space: normal; word-wrap: break-word; text-align: center; }
}
