/* CSS RESET & BOX MODEL */
.iqt-header-meta-box, .iqt-header-meta-box * {
    box-sizing: border-box;
}

/* Header Meta Box */
.iqt-header-meta-box {
    width: 98%;
    max-width: 880px;
    margin: 0 auto 10px auto;
    padding: 18px 20px;
    background: #f9f6f2; /* تغییر جزیی بک‌گراند طبق کد دوم شما */
    border: 1.5px solid #f5e7ce;
    border-radius: 18px;
    box-shadow: 0 4px 18px 0 rgba(44, 62, 80, 0.05);
    font-family: inherit;
    direction: rtl;
    text-align: right;
    display: block; /* حذف flex */
}

/* Table Layout for Top Row */
.iqt-header-table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    margin-bottom: 15px;
}
.iqt-header-table td {
    padding: 0;
    vertical-align: middle;
}
.iqt-col-logo-right {
    text-align: right;
}
.iqt-col-title {
    text-align: center;
}
.iqt-col-logo-left {
    text-align: left; /* چپ چین کردن لوگوی سمت چپ */
}

.iqt-logo {
    /* تغییر مهم: به جای width و height ثابت */
    max-width: 80px;
    max-height: 80px;
    
    /* اجازه دهید مرورگر خودش نسبت را حفظ کند */
    width: auto;
    height: auto;
    
    /* این دستور در PDF ساز کار نمی‌کند، پس بود و نبودش فرقی ندارد */
    /* object-fit: contain; */ 
    
    display: inline-block;
    vertical-align: middle;
}


/* Title Area */
.iqt-meta-top {
    text-align: center;
    padding: 0 20px;
}

.iqt-meta-title {
    font-size: 22px;
    font-weight: bold;
    color: #ad8125; /* رنگ طبق کد دوم */
    display: block;
    margin-bottom: 8px;
}

/* Divider */
.iqt-divider {
    border: none;
    border-top: 1px solid #eee; /* فال‌بک */
    height: 1px;
    background: linear-gradient(to right, transparent, #ddd, transparent);
    opacity: 0.85;
    margin: 15px 0;
    display: block;
    clear: both;
}

/* Info Row (Row 2) - Inline Block Method */
.iqt-header-row2 {
    width: 100%;
    text-align: center; /* جایگزین justify-content: space-around */
    margin: 15px 0;
    font-size: 0; /* حذف فاصله سفید بین inline-block ها */
}

.iqt-info-item {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 5px;
    margin: 5px 8px; /* فاصله بین آیتم‌ها */
    font-size: 16px; /* بازگرداندن سایز فونت */
    color: #444;
    vertical-align: middle;
    text-align: right;
}

/* Buttons Area - Inline Block Method */
.iqt-meta-buttons {
    text-align: center; /* جایگزین justify-content center */
    margin-top: 8px;
    font-size: 0;
}

.iqt-meta-btn {
    display: inline-block;
    padding: 10px 24px; /* تنظیم پدینگ */
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    color: #fff;
    margin: 5px; /* فاصله دکمه‌ها */
    vertical-align: middle;
    cursor: pointer;
    border: none;
}

/* PDF Button Specifics */
.pdf-btn {
    position: relative;
    min-width: 200px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    /* برای تراز بندی محتویات داخل دکمه بدون فلکس */
    line-height: 48px; /* عمودی کردن متن */
    padding: 0 20px;
}

/* تراز بندی آیکون و متن داخل دکمه PDF بدون فلکس */
.pdf-btn span {
    display: inline-block;
    vertical-align: middle;
    line-height: normal; /* ریست لاین هایت برای اسپن */
}

.pdf-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: #d94772; /* هاور طبق کد دوم */
}

.pdf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Retry Button */
.retry-btn {
    background: #5b9df4; /* رنگ طبق کد دوم */
    line-height: 28px; /* برای هم‌ارتفاع شدن تقریبی */
}

.retry-btn:hover {
    background: #3a86dc;
}

.btn-icon {
    font-size: 16px;
    margin-left: 5px; /* فاصله آیکون از متن */
}

/* Loader Animation (CSS Only - wkhtmltopdf wont animate but renders container) */
.btn-loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
    /* انیمیشن در PDF کار نمی‌کند اما در مرورگر چرا */
    animation: spin 1s linear infinite; 
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Logic for PDF (Minimal overrides) */
@media (max-width: 500px) {
  .iqt-logo {
    /* تغییر مهم: به جای width و height ثابت */
    max-width: 50px;
    max-height: 50px;
    
    /* اجازه دهید مرورگر خودش نسبت را حفظ کند */
    width: auto;
    height: auto;
    
    /* این دستور در PDF ساز کار نمی‌کند، پس بود و نبودش فرقی ندارد */
    /* object-fit: contain; */ 
    
    display: inline-block;
    vertical-align: middle;
}

    .iqt-meta-title {
        font-size: 16px;
    }
    .iqt-info-item {
        display: block; /* در موبایل زیر هم قرار گیرند */
        width: 100%;
        margin: 5px 0;
        text-align: center;
    }
    .iqt-meta-btn {
        display: block;
        width: 90%;
        margin: 10px auto;
        text-align: center;
    }
}
