* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Vazirmatn', sans-serif;
    background: #f4f5f9;
    color: #1e1e2f;
    direction: rtl;
}

.ticket-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.ticket-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.ticket-card.wide {
    max-width: 700px;
}

.ticket-card h1 {
    font-size: 1.6rem;
    margin: 0 0 8px;
}

.subtitle {
    color: #6b6b80;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6c5ce7;
}

.submit-btn {
    background: #6c5ce7;
    color: #fff;
    border: none;
    padding: 13px 30px;
    border-radius: 10px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.3);
}

.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fdeaea;
    color: #c0392b;
}

.alert-error ul {
    margin: 0;
    padding-inline-start: 18px;
}

.alert-success {
    background: #eafaf1;
    color: #1e8449;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.status-badge {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-open {
    background: #eafaf1;
    color: #1e8449;
}

.status-pending {
    background: #fff6e5;
    color: #b8860b;
}

.status-closed {
    background: #f0f0f0;
    color: #666;
}

.thread {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 25px;
    max-height: 420px;
    overflow-y: auto;
}

.message {
    padding: 14px 16px;
    border-radius: 12px;
    max-width: 85%;
}

.message.from-user {
    background: #f0f0fb;
    align-self: flex-start;
}

.message.from-admin {
    background: #6c5ce7;
    color: #fff;
    align-self: flex-end;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    opacity: 0.75;
    margin-bottom: 6px;
    gap: 10px;
}

.message-body {
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 0.92rem;
}

.reply-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-family: inherit;
    margin-bottom: 12px;
    resize: vertical;
}

.closed-note {
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

.mt-3 {
    margin-top: 16px;
}

.text-center {
    text-align: center;
}

.text-center a {
    color: #6c5ce7;
    font-weight: 600;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 10px;
    text-decoration: none;
    color: #1e1e2f;
    transition: box-shadow .2s, transform .2s;
}

.ticket-row:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.d-flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* دکمه‌ی بازگشت به خانه - همیشه ثابت بالای صفحه */
.back-home-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e5f0;
    border-radius: 30px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e1e2f;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    transition: all .25s ease;
}

.back-home-btn:hover {
    background: linear-gradient(135deg, #6c5ce7, #341f97);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(108, 92, 231, 0.35);
}

/* پیوست‌های تصویری */
.attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.attachments img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: transform .2s;
    cursor: pointer;
}

.attachments img:hover {
    transform: scale(1.05);
}

/* دکمه‌ی ghost (خنثی) برای خروج/بازگشت */
.btn-ghost {
    background: #f0f0f5 !important;
    color: #1e1e2f !important;
}

.btn-ghost:hover {
    background: #e2e2ee !important;
}

/* ظاهر جذاب‌تر کل کارت‌ها و بدنه‌ی سایت */
body {
    background: linear-gradient(160deg, #f4f5fb 0%, #eef0f9 100%);
}

.ticket-card {
    box-shadow: 0 10px 40px rgba(108, 92, 231, 0.08);
    border: 1px solid #f0f0f8;
}

.ticket-card h1 {
    background: linear-gradient(135deg, #6c5ce7, #341f97);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* جذاب‌تر کردن input فایل */
input[type="file"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px dashed #ccc;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    background: #fafafe;
}

input[type="file"]:hover {
    border-color: #6c5ce7;
}

.ticket-card.full-width {
    max-width: 1400px;
    width: 95%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.d-inline {
    display: inline;
}

.dash-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.dash-tab {
    background: none;
    border: none;
    padding: 10px 18px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    color: #6b6b80;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .2s ease;
}

.dash-tab:hover {
    color: #6c5ce7;
}

.dash-tab.active {
    color: #6c5ce7;
    border-bottom-color: #6c5ce7;
}

.license-row, .payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 10px;
}

.license-key {
    font-family: monospace;
    font-size: 0.8rem;
    color: #6b6b80;
    margin-top: 4px;
}

.license-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.license-date {
    font-size: 0.75rem;
    color: #6b6b80;
}

.payment-meta {
    font-size: 0.8rem;
    color: #6b6b80;
    margin-top: 4px;
}

.payment-amount {
    font-weight: 700;
    color: #1e8449;
    font-size: 1rem;
}

.profile-box {
    max-width: 500px;
    margin: 0 auto;
}

.avatar-preview {
    text-align: center;
    margin-bottom: 25px;
}

.avatar-preview img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #f0f0fb;
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.15);
}

.profile-form .form-group {
    margin-bottom: 16px;
}

.profile-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
}

.profile-form input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #e5e5f0;
    border-radius: 10px;
    font-family: inherit;
}

.profile-form input:focus {
    outline: none;
    border-color: #6c5ce7;
}

.header-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f0f0fb;
}

.resend-verify-btn {
    background: #e03131;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all .2s ease;
    box-shadow: 0 4px 12px rgba(224, 49, 49, 0.2);
}

.resend-verify-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(224, 49, 49, 0.32);
}

/* ===================== ریسپانسیو موبایل - پنل مشتری ===================== */
@media (max-width: 480px) {
    .ticket-wrapper {
        align-items: flex-start;
        padding: 16px 12px 90px; /* پدینگ پایین برای رزرو جای دکمه‌ی چت شناور */
    }

    .ticket-card.full-width {
        width: 100%;
        padding: 20px 16px;
        border-radius: 12px;
    }

    .ticket-card h1 {
        font-size: 1.25rem;
    }

    .header-avatar {
        width: 38px;
        height: 38px;
    }

    /* نوار تب‌ها: به‌جای شکستن متن، اسکرول افقی */
    .dash-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        margin: 0 -16px 16px;
        padding: 0 16px 4px;
    }

    .dash-tabs::-webkit-scrollbar {
        display: none;
    }

    .dash-tab {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    .back-home-btn {
        top: 12px;
        right: 12px;
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .license-row, .payment-row, .ticket-row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .license-meta {
        align-items: flex-start;
        width: 100%;
    }
}

.license-domain {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.license-domain form {
    margin: 0;
}

.license-domain__on {
    font-size: 13px;
    font-weight: 700;
    color: #378c3f;
    direction: ltr;
}

.license-domain__off {
    font-size: 12px;
    color: #9a9aa5;
}

.license-release-btn {
    border: 1px solid rgba(220, 53, 69, .35);
    background: rgba(220, 53, 69, .06);
    color: #c82333;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all .2s ease;
}

.license-release-btn:hover {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}
