/**
 * File: assets/css/public.css
 */

/* تنظیم فونت کلی برای هماهنگی با قالب */
:root {
    --pcc-font-family: var(--e-global-typography-text-font-family, var(--font-family-body, inherit));
}

.pcc-container, 
.pcc-container *, 
.pcc-container button, 
.pcc-container select, 
.pcc-container input, 
.pcc-container label, 
.pcc-container option {
    font-family: var(--pcc-font-family) !important;
}

.pcc-container {
    direction: rtl;
    text-align: right;
    max-width: 850px;
    margin: 20px auto;
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.pcc-form h3, .pcc-result-header h4 {
    margin-top: 0;
    color: #1e293b;
    font-size: 1.4rem;
    margin-bottom: 20px;
    font-weight: 700;
}

/* سیستم گرید فرم */
.pcc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px 20px;
    margin-bottom: 20px;
}

.pcc-field {
    display: flex;
    flex-direction: column;
}

.pcc-field label {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 6px;
    font-weight: 500;
}

.pcc-field input[type="text"],
.pcc-field input[type="tel"],
.pcc-field input[type="number"],
.pcc-field select {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    background-color: #f8fafc !important;
    font-size: 0.9rem !important;
    color: #334155 !important;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.pcc-field input:focus,
.pcc-field select:focus {
    border-color: #0284c7 !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    outline: none !important;
}

/* اعتبارسنجی لحظه‌ای */
.pcc-field input[aria-invalid="true"],
.pcc-field select[aria-invalid="true"] {
    border-color: #dc2626 !important;
    background-color: #fef2f2 !important;
}

.pcc-error {
    display: block;
    color: #dc2626;
    font-size: 0.78rem;
    margin-top: 4px;
    min-height: 14px;
}

.pcc-form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.85rem;
}

/* پیش‌نمایش زنده قیمت */
.pcc-live-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 18px;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.pcc-live-preview.is-active {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
}

.pcc-live-preview-label {
    font-size: 0.78rem;
    color: #64748b;
}

.pcc-live-preview #pcc-live-preview-value {
    font-size: 1.1rem;
    color: #0f172a;
}

.pcc-live-preview.is-active #pcc-live-preview-value {
    color: #0369a1;
}

.pcc-live-preview-note {
    font-size: 0.72rem;
    color: #94a3b8;
}

/* چک‌باکس‌ها */
.pcc-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 15px 0 25px 0;
    padding: 10px 0;
    border-top: 1px dashed #e2e8f0;
}

/* دکمه ارسال */
.pcc-submit-btn {
    width: 100%;
    background: #0284c7;
    color: #fff;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.pcc-submit-btn:hover { background: #0369a1; }

/* استایل نتایج محاسبات */
.pcc-result {
    margin-top: 30px;
    border: 2px solid #bae6fd;
    background: #f0f9ff;
    border-radius: 10px;
    padding: 20px;
    animation: fadeIn 0.4s ease-in-out;
}

.pcc-result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.pcc-summary-item {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0f2fe;
    text-align: center;
}

.pcc-summary-item strong {
    display: block;
    font-size: 1.3rem;
    color: #0f172a;
}

/* جدول جدید ریز هزینه‌ها */
.pcc-result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.95rem;
}

.pcc-result-table th {
    background: #e0f2fe;
    color: #0369a1;
    padding: 8px 0px;
    text-align: right;
    border-bottom: 1px solid #bae6fd;
}

.pcc-result-table td {
    padding: 8px 0px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

/* اصلاح تراز مبلغ: عدد راست، واحد چپ */
.pcc-text-right {
    text-align: right !important;
    direction: rtl !important;
}

.pcc-price-value {
    font-weight: 700;
    color: #0f172a;
    direction: ltr;
    display: inline-block;
}

.pcc-price-unit {
    margin-right: 6px;
    font-size: 0.85rem;
    color: #64748b;
}

/* انیمیشن و ریسپانسیو */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .pcc-container { padding: 15px; }
    .pcc-result-table th, .pcc-result-table td {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
}