/**
 * 1. تعریف فونت‌های IRANSansX
 * --------------------------------
 * ما به مرورگر می‌گوییم که دو وزن از یک خانواده فونت به نام 'IRANSansX' داریم.
 * مرورگر همیشه اول فرمت woff2 را به دلیل حجم کمتر امتحان می‌کند.
 */

/* تعریف فونت معمولی (Regular) */
@font-face {
  font-family: 'IRANSansX';
  src: url('../fonts/Woff2/IRANSansXFaNum-Regular.woff2') format('woff2'),
       url('../fonts/Woff/IRANSansXFaNum-Regular.woff') format('woff');
  font-weight: normal; /* یا 400 */
  font-style: normal;
  font-display: swap; /* برای بارگذاری بهتر */
}

/* تعریف فونت ضخیم (Bold) */
@font-face {
  font-family: 'IRANSansX';
  src: url('../fonts/Woff2/IRANSansXFaNum-Bold.woff2') format('woff2'),
       url('../fonts/Woff/IRANSansXFaNum-Bold.woff') format('woff');
  font-weight: bold; /* یا 700 */
  font-style: normal;
  font-display: swap; /* برای بارگذاری بهتر */
}


/**
 * 2. اعمال فونت به کل صفحه
 * --------------------------------
 * حالا خانواده فونت 'IRANSansX' را به کل بدنه سایت و عناصری که
 * معمولاً فونت را به ارث نمی‌برند (مثل دکمه و اینپوت) اعمال می‌کنیم.
 */
body,
button,
input,
textarea,
select {
    font-family: 'IRANSansX', sans-serif;
}
/* ================== Profile Page Styles ================== */
body {
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.profile-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.profile-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    position: relative;
}

.profile-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.profile-header p {
    font-size: 16px;
    color: #666;
    margin-top: 5px;
}

.logout-link {
    position: absolute;
    top: 0;
    left: 0;
    text-decoration: none;
    background: #e74c3c;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
}

.profile-form fieldset {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 25px;
}

.profile-form legend {
    padding: 0 10px;
    font-weight: bold;
    color: #3498db;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap; /* برای واکنش‌گرایی */
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 200px; /* حداقل عرض برای هر فیلد */
}

.form-group.full-width {
    flex-basis: 100%;
}

.form-group label {
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="tel"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

/* برای فیلدهای چپ‌چین */
.ltr {
    direction: ltr;
    text-align: left;
}

.radio-group {
    align-items: center;
    justify-content: space-between;
    background-color: #f9f9f9;
    padding: 10px;
    border-radius: 5px;
}
.radio-group > label {
    flex-basis: 40%;
}
.radio-group div {
    display: flex;
    align-items: center;
    gap: 8px;
}
.radio-group input[type="radio"] {
    margin: 0;
}


.btn-submit {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    background-color: #27ae60;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-submit:hover {
    background-color: #229954;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}


/* واکنش‌گرایی برای موبایل */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    .profile-container {
        margin: 20px auto;
        padding: 20px;
    }
    .logout-link {
        position: static;
        display: block;
        margin-top: 10px;
    }
}

/* ================== Register Page Styles ================== */
.register-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.hidden {
    display: none;
}

#registration-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.module-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease-in-out;
}
.module-item:not(.disabled):hover {
    border-color: #3498db;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.module-item.disabled {
    background-color: #f4f4f4;
    color: #aaa;
}
.module-item.disabled label {
    cursor: not-allowed;
}

.module-item input[type="checkbox"] {
    margin-left: 10px;
    width: 20px;
    height: 20px;
}

.module-item label {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    width: 100%;
}

.module-name {
    font-weight: bold;
}
.module-price {
    color: #27ae60;
    font-size: 14px;
}
.module-capacity {
    font-size: 12px;
    color: #888;
}

.summary-box {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px dashed #ccc;
    border-radius: 5px;
    text-align: center;
}
.summary-box h4 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
}
.summary-box #total-price {
    color: #2c3e50;
    font-weight: bold;
}
/* ================== Login Page Info Dialog ================== */

/* اصلاح استایل body صفحه ورود برای چیدمان عمودی */
.login-body {
    flex-direction: column; /* باعث می‌شود دیالوگ و کادر ورود زیر هم قرار بگیرند */
}

/* استایل اصلی دیالوگ */
.info-dialog {
    background-color: #fff3e0; /* پس‌زمینه نارنجی ملایم */
    border: 1px solid #ffe0b2; /* بوردر نارنجی کمی تیره‌تر */
    color: #bf360c; /* رنگ متن نارنجی تیره برای خوانایی */
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px; /* فاصله از کادر ورود */
    max-width: 400px; /* هماهنگی عرض با کادر ورود */
    width: 100%;
    box-sizing: border-box;
    text-align: right;
    line-height: 1.7;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.info-dialog p {
    margin: 0;
    font-size: 14px;
}

.info-dialog a {
    color: #e65100; /* رنگ لینک برای تاکید بیشتر */
    font-weight: bold;
    text-decoration: none;
}

.info-dialog a:hover {
    text-decoration: underline;
}

/* هماهنگ کردن کادر ورود با دیالوگ جدید */
.login-container {
    margin-top: 0;
}

/* ================== Checkout Page Styles ================== */
.checkout-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.invoice-box {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-bottom: 30px;
}

.invoice-box h3, .invoice-box h4 {
    margin-top: 0;
}

.invoice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 16px;
}
.invoice-item span {
    color: #555;
}

hr {
    border: 0;
    border-top: 1px solid #eee;
    margin: 15px 0;
}

.module-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.module-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f9f9f9;
}
.module-list .price {
    font-family: sans-serif; /* برای نمایش بهتر اعداد */
    font-weight: 500;
    color: #333;
}

.invoice-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 15px;
    color: #2c3e50;
}

.payment-form h3 {
    text-align: center;
    margin-bottom: 20px;
}

.payment-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.payment-option {
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
.payment-option:hover {
    border-color: #3498db;
}
.payment-option input[type="radio"]:checked + .option-content {
    /* استایل در حالت انتخاب شده در ادامه با js یا :has اضافه می‌شود */
    /* فعلا با بوردر مشخص می‌کنیم */
}

input[type="radio"]:checked {
    accent-color: #3498db;
}

/* استایل وقتی یک گزینه انتخاب می‌شود */
.payment-option input[type="radio"]:checked ~ .option-content .option-title {
    color: #3498db;
}
.payment-option input[type="radio"] {
    margin-left: 15px;
    width: 20px;
    height: 20px;
}

.option-content {
    display: flex;
    flex-direction: column;
}
.option-title {
    font-weight: bold;
    font-size: 16px;
}
.option-desc {
    font-size: 13px;
    color: #777;
}
/* ================== 404 Page Styles ================== */
.body-404 {
    background-color: #f4f6f9;
    color: #444;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
    margin: 0;
}

.container-404 {
    max-width: 500px;
}

.code-404 {
    font-size: 120px;
    font-weight: bold;
    color: #34495e;
    margin: 0;
    text-shadow: 4px 4px 0px #d5d9e2;
}

.container-404 h1 {
    font-size: 28px;
    margin-top: 0;
    color: #2c3e50;
}

.container-404 p {
    font-size: 18px;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.btn-404 {
    display: inline-block;
    padding: 12px 25px;
    background-color: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-404:hover {
    background-color: #2980b9;
}
.invoice-summary {
    margin-top: 15px;
}
.invoice-item.discount span {
    color: #e74c3c; /* رنگ قرمز برای تخفیف */
    font-weight: bold;
}

/* Styles for disabled payment option and terms */
.payment-option.disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.6;
}
.update-label {
    color: #e74c3c;
    font-size: 12px;
    font-weight: bold;
    margin-right: 5px;
}

.terms-container {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
}
.terms-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
}
.btn-submit:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}
/* Style for the link inside terms */
.terms-container label a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}
.terms-container label a:hover {
    text-decoration: underline;
}

/* Style for the error message */
.error-message {
    color: #c0392b;
    background-color: #fbeae5;
    border: 1px solid #e74c3c;
    padding: 10px;
    border-radius: 5px;
    margin-top: -10px; /* فاصله منفی برای نزدیک شدن به بخش قوانین */
    margin-bottom: 20px; /* فاصله از دکمه */
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

/* Styles for Sold Out Label */
.module-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.module-info {
    display: flex;
    flex-direction: column;
}

.sold-out-label {
    background-color: #e74c3c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 4px;
}
/* ================== Register Page Layout Fixes ================== */

/* تنظیمات کلی کانتینر صفحه ثبت‌نام */
.register-container {
    max-width: 750px; /* کمی عرض را برای خوانایی بهتر تنظیم می‌کنیم */
    padding: 30px 40px; /* پدینگ داخلی را افزایش می‌دهیم */
}

/* استایل جدید برای بخش‌ها (fieldset) */
.register-container fieldset {
    border: 1px solid #e9ecef; /* یک بوردر ملایم‌تر */
    border-radius: 8px;
    padding: 25px; /* پدینگ داخلی بخش‌ها */
    margin-bottom: 25px;
    background-color: #fdfdfd;
}

/* استایل جدید برای عنوان بخش‌ها (legend) */
.register-container legend {
    padding: 0 10px;
    font-weight: bold;
    font-size: 1.1rem;
    color: #3498db;
    margin-right: 5px; /* کمی فاصله از لبه راست */
}

/* تنظیم فاصله بین لیبل و دراپ‌دان */
.register-container .form-group.full-width {
    display: flex;
    flex-direction: column;
    gap: 10px; /* ایجاد فاصله بین لیبل و دراپ‌دان */
}

.register-container .form-group label {
    font-weight: 500;
    font-size: 15px;
    color: #495057;
}

/* بهبود ظاهر دراپ‌دان‌ها */
.register-container select {
    padding: 12px; /* افزایش ارتفاع */
    font-size: 1rem;
    border-color: #ced4da;
}
/* Styles for Module Items and Sold Out Label */
.module-item label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.module-info {
    display: flex;
    flex-direction: column;
}

.sold-out-label {
    background-color: #e74c3c; /* Red */
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 4px;
}

/* Style for the whole disabled item */
.module-item.disabled {
    background-color: #f8f9fa;
    color: #adb5bd;
}
.module-item.disabled label {
    cursor: not-allowed;
}