@font-face {
    font-family: 'Vazirmatn';
    src: url('fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(138, 43, 226, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo h1 {
    color: #bb86fc;
    font-size: 1.8rem;
    font-weight: bold;
}

.btn-contact {
    background: linear-gradient(135deg, #bb86fc 0%, #8a2be2 100%);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
    font-weight: 600;
}

.btn-contact:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(187, 134, 252, 0.4);
}

/* Hero Banner */
.hero-banner {
    padding: 5rem 0;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 3rem;
    color: #bb86fc;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 30px rgba(187, 134, 252, 0.5);
}

.hero-text {
    font-size: 1.3rem;
    color: #b0b0b0;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.btn-start {
    display: inline-block;
    background: linear-gradient(135deg, #bb86fc 0%, #8a2be2 100%);
    color: white;
    padding: 1rem 3rem;
    border-radius: 30px;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-start:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(187, 134, 252, 0.5);
}

/* About Section */
.about-section {
    padding: 4rem 0;
    background: rgba(22, 33, 62, 0.5);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    color: #bb86fc;
    margin-bottom: 3rem;
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
}

.about-text {
    font-size: 1.1rem;
    color: #c0c0c0;
    margin-bottom: 1.5rem;
    text-align: justify;
    line-height: 2;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: rgba(26, 26, 46, 0.7);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid rgba(187, 134, 252, 0.2);
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(187, 134, 252, 0.3);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    color: #bb86fc;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

.feature-card p {
    color: #b0b0b0;
    font-size: 0.95rem;
}

/* Ads Section */
.ads-section {
    padding: 3rem 0;
}

.ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.ad-slot {
    background: rgba(26, 26, 46, 0.5);
    border: 2px dashed rgba(187, 134, 252, 0.3);
    border-radius: 10px;
    padding: 3rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-text {
    color: #808080;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Calculator Section */
.calculator-section {
    padding: 4rem 0;
    background: rgba(22, 33, 62, 0.3);
}

.calc-card {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(187, 134, 252, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.calc-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(187, 134, 252, 0.2);
}

.card-title {
    color: #bb86fc;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.input-field {
    flex: 1;
    padding: 1rem 1.5rem;
    background: rgba(22, 33, 62, 0.8);
    border: 2px solid rgba(187, 134, 252, 0.3);
    border-radius: 12px;
    color: #e0e0e0;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: #bb86fc;
    box-shadow: 0 0 15px rgba(187, 134, 252, 0.3);
}

.input-field::placeholder {
    color: #808080;
}

.amount-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.amount-input-wrapper .input-field {
    padding-left: 5rem;
}

.currency-label {
    position: absolute;
    left: 1.5rem;
    color: #bb86fc;
    font-weight: 600;
    pointer-events: none;
}

.btn-add {
    background: linear-gradient(135deg, #bb86fc 0%, #8a2be2 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(187, 134, 252, 0.4);
}

.btn-add:active {
    transform: translateY(0);
}

/* People List */
.people-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.person-item {
    background: rgba(22, 33, 62, 0.6);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(187, 134, 252, 0.2);
    transition: background 0.2s;
}

.person-item:hover {
    background: rgba(22, 33, 62, 0.8);
}

.person-name {
    color: #e0e0e0;
    font-weight: 500;
    font-size: 1.05rem;
}

.btn-remove {
    background: transparent;
    color: #ff4757;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
}

.btn-remove:hover {
    background: rgba(255, 71, 87, 0.2);
    transform: scale(1.1);
}

/* Expense Form */
.expense-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.participants-list {
    background: rgba(22, 33, 62, 0.5);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(187, 134, 252, 0.2);
}

.no-people-msg {
    color: #808080;
    text-align: center;
    font-style: italic;
}

.participants-title {
    color: #bb86fc;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    cursor: pointer;
    color: #e0e0e0;
    padding: 0.7rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: rgba(187, 134, 252, 0.1);
}

.participant-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #bb86fc;
}

/* Expenses List */
.expenses-list {
    margin-top: 2rem;
}

.no-expenses-msg {
    color: #808080;
    text-align: center;
    font-style: italic;
    padding: 2rem;
}

.expense-item {
    background: rgba(22, 33, 62, 0.6);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border: 1px solid rgba(187, 134, 252, 0.2);
    transition: background 0.2s;
}

.expense-item:hover {
    background: rgba(22, 33, 62, 0.8);
}

.expense-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.expense-info strong {
    color: #bb86fc;
    font-size: 1.2rem;
}

.expense-amount {
    color: #4ecca3;
    font-weight: 600;
    font-size: 1.1rem;
}

.expense-payer,
.expense-participants {
    color: #b0b0b0;
    font-size: 0.95rem;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.btn-calculate {
    background: linear-gradient(135deg, #4ecca3 0%, #2ecc71 100%);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-calculate:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(78, 204, 163, 0.4);
}

.btn-clear {
    background: linear-gradient(135deg, #ff4757 0%, #e74c3c 100%);
    color: white;
    border: none;
    padding: 1.2rem 3rem;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-clear:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.4);
}

/* Results Section */
.results-section {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 3rem;
    margin-top: 3rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(187, 134, 252, 0.3);
}

.result-card {
    background: rgba(22, 33, 62, 0.5);
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    border: 1px solid rgba(187, 134, 252, 0.2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.result-card h4 {
    color: #bb86fc;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    margin-top: 1rem;
}

.result-table thead {
    background: rgba(187, 134, 252, 0.2);
}

.result-table th {
    padding: 1rem;
    text-align: center;
    color: #bb86fc;
    font-weight: 600;
    border-bottom: 2px solid rgba(187, 134, 252, 0.3);
}

.result-table td {
    padding: 1rem;
    text-align: center;
    color: #e0e0e0;
    border-bottom: 1px solid rgba(187, 134, 252, 0.1);
}

.result-table tbody tr:hover {
    background: rgba(187, 134, 252, 0.1);
}

.creditor {
    color: #4ecca3 !important;
    font-weight: 600;
}

.debtor {
    color: #ff6b6b !important;
    font-weight: 600;
}

.settled {
    color: #95a5a6 !important;
    font-weight: 600;
}

.no-settlement {
    color: #4ecca3;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 2rem !important;
}

.btn-share {
    display: block;
    margin: 2rem auto 0;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 15px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Vazirmatn', sans-serif;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-share:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(52, 152, 219, 0.4);
}

.btn-share:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Sponsor Section */
.sponsor-section {
    padding: 4rem 0;
    background: rgba(26, 26, 46, 0.5);
}

.sponsor-content {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.sponsor-title {
    color: #bb86fc;
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.sponsor-text {
    color: #c0c0c0;
    font-size: 1.1rem;
    line-height: 2;
    margin-bottom: 2rem;
}

.sponsor-services {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.service-tag {
    background: rgba(187, 134, 252, 0.2);
    color: #bb86fc;
    padding: 0.7rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    border: 1px solid rgba(187, 134, 252, 0.3);
}

.btn-sponsor {
    display: inline-block;
    background: linear-gradient(135deg, #bb86fc 0%, #8a2be2 100%);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-sponsor:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(187, 134, 252, 0.5);
}

/* Contact Section */
.contact-section {
    padding: 3rem 0;
}

.contact-content {
    text-align: center;
}

.contact-info h3 {
    color: #bb86fc;
    font-size: 2rem;
    margin-bottom: 1rem;
}

.contact-info p {
    color: #b0b0b0;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.contact-phone {
    display: inline-block;
    background: linear-gradient(135deg, #4ecca3 0%, #2ecc71 100%);
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.contact-phone:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(78, 204, 163, 0.4);
}

/* Footer */
.footer {
    background: rgba(26, 26, 46, 0.95);
    padding: 2rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.footer-logo h3 {
    color: #bb86fc;
    font-size: 1.5rem;
}

.footer-nav {
    display: flex;
    gap: 2rem;
}

.footer-link {
    color: #b0b0b0;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    color: #bb86fc;
}

.footer-contact {
    color: #4ecca3;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s;
}

.footer-contact:hover {
    color: #2ecc71;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(187, 134, 252, 0.2);
}

.footer-bottom p {
    color: #808080;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {

    /* ===== هدر موبایل ===== */
    .header-content {
        justify-content: space-between;
        flex-wrap: nowrap;
        padding: 0 4px;
    }

    .logo h1 {
        font-size: 1.4rem;
    }

    .btn-contact {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* ===== hero ===== */
    .hero-title { font-size: 1.7rem; }
    .hero-text  { font-size: 1rem; }
    .section-title { font-size: 1.7rem; }

    /* ===== فرم‌ها ===== */
    .input-group { flex-direction: column; }

    .action-buttons { flex-direction: column; }
    .btn-calculate, .btn-clear { width: 100%; }

    /* ===== باکس پیش‌پرداخت و شرکت‌کنندگان ===== */
    .prepayment-box {
        border-radius: 10px;
        padding: 0.9rem 1rem;
    }

    .prepayment-toggle {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        padding: 2px 0;
        min-height: 44px;   /* حداقل اندازه لمس */
    }

    .prepayment-toggle-right {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex: 1;
        min-width: 0;
    }

    .prepayment-label {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .optional-badge {
        font-size: 0.68rem;
        padding: 2px 6px;
        flex-shrink: 0;
    }

    .prepayment-arrow {
        font-size: 0.75rem;
        flex-shrink: 0;
        padding-right: 4px;
    }

    .prepayment-body {
        /* اطمینان از نمایش صحیح روی موبایل */
        overflow: hidden;
    }

    .prepayment-body.open {
        max-height: 1000px;
        opacity: 1;
        margin-top: 1rem;
    }

    .prepayment-hint {
        font-size: 0.8rem;
        padding: 0.5rem 0.7rem;
    }

    /* پیش‌پرداخت ردیف‌ها */
    .prepayment-row {
        gap: 0.4rem;
    }

    .prepayment-person {
        font-size: 0.85rem;
        max-width: 30%;
    }

    .prepayment-input {
        font-size: 1rem !important;
        padding: 0.55rem 2.6rem 0.55rem 0.5rem !important;
    }

    /* چک‌باکس‌های شرکت‌کنندگان */
    .participants-checkboxes {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .checkbox-label {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.5rem 0.3rem;
        min-height: 40px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .checkbox-label input[type="checkbox"] {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
        cursor: pointer;
        accent-color: #bb86fc;
    }

    .btn-select-all {
        min-height: 36px;
        padding: 6px 12px;
        font-size: 0.85rem;
        touch-action: manipulation;
    }

    /* پرداخت‌کننده */
    .payer-row {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .select-field {
        font-size: 1rem !important; /* جلوگیری از zoom روی iOS */
        min-height: 44px;
    }

    /* ===== layout هزینه‌ها ===== */
    /* expense-layout در 900px به ستون تبدیل می‌شه (قبلاً تعریف شده) */

    /* ===== جداول نتایج ===== */
    .result-card {
        margin: 0 -0.5rem;  /* کمی عرض بیشتر */
    }
    .result-table { font-size: 0.75rem; min-width: 360px; }
    .result-table th,
    .result-table td { padding: 0.45rem 0.3rem; }
    .summary-cell { font-size: 0.75rem; line-height: 1.8; }

    /* ===== footer ===== */
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .footer-nav {
        flex-direction: column;
        align-items: center;
    }

    /* ===== دکمه تأیید پیش‌پرداخت ===== */
    .btn-confirm-prepay {
        font-size: 0.95rem;
        min-height: 44px;
    }

    .btn-edit-prepay {
        min-height: 36px;
        font-size: 0.85rem;
    }
}
/* استایل فیلد انتخاب پرداخت‌کننده */
/* select-field قدیمی جایگزین شد */

/* استایل دکمه انتخاب همه */
.btn-select-all {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #e0e7ff;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.3s ease;
}

.btn-select-all:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
}

.btn-select-all:active {
    transform: scale(0.98);
}

/* هدر شرکت‌کنندگان */
.participants-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.participants-header label {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}


/* اضافه کن به style.css */

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}


/* ==================== استایل‌های خطا و اعتبارسنجی ==================== */
.input-error {
    border-color: #ff4757 !important;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.3) !important;
}

.error-message {
    display: block;
    color: #ff4757;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    padding-right: 0.5rem;
}

/* ==================== بهبود select-field ==================== */
.select-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(187, 134, 252, 0.4);
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Vazirmatn', sans-serif;
    background: rgba(22, 33, 62, 0.8);
    color: #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-field:hover {
    border-color: rgba(187, 134, 252, 0.6);
    background: rgba(22, 33, 62, 0.95);
}

.select-field:focus {
    outline: none;
    border-color: #bb86fc;
    box-shadow: 0 0 15px rgba(187, 134, 252, 0.3);
}

.select-field option {
    background-color: #1a1a2e;
    color: #e0e0e0;
    padding: 10px;
}

/* ==================== لایه‌بندی دو ستونه هزینه‌ها ==================== */

.expense-layout {
    display: grid;
    grid-template-columns: 1fr 3px 1fr;
    gap: 0 2rem;
    align-items: start;
}

.expense-form-col,
.expense-list-col {
    min-width: 0;
}

.col-title {
    color: #bb86fc;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid rgba(187, 134, 252, 0.2);
}

.expense-divider {
    background: rgba(187, 134, 252, 0.2);
    width: 1px;
    min-height: 300px;
    align-self: stretch;
    margin: 0 0.5rem;
}

.btn-add-full {
    width: 100%;
    margin-top: 0.5rem;
}

/* ==================== باکس پیش‌پرداخت ==================== */

.prepayment-box {
    background: rgba(187, 134, 252, 0.06);
    border: 1px dashed rgba(187, 134, 252, 0.35);
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    margin-top: 0.5rem;
}

.prepayment-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.prepayment-icon {
    font-size: 1.2rem;
}

.prepayment-label {
    color: #bb86fc;
    font-weight: 600;
    font-size: 1rem;
}

.optional-badge {
    background: rgba(187, 134, 252, 0.15);
    color: #bb86fc;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid rgba(187, 134, 252, 0.3);
    font-weight: 500;
    margin-right: 4px;
}

.prepayment-hint {
    color: #f0a500;
    font-size: 0.82rem;
    margin-bottom: 1rem;
    line-height: 1.6;
    background: rgba(240, 165, 0, 0.08);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
}

.prepayment-fields {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.prepayment-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
}

.prepayment-person {
    color: #e0e0e0;
    font-weight: 500;
    font-size: 0.9rem;
    flex-shrink: 0;
    max-width: 35%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prepayment-amount-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.prepayment-input {
    width: 100% !important;
    padding: 0.55rem 2.8rem 0.55rem 0.7rem !important;
    font-size: 1rem !important;
    min-width: 0;
}

.currency-label-sm {
    position: absolute;
    right: 0.6rem;
    left: auto;
    color: #bb86fc;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
}

/* ==================== نمایش پیش‌پرداخت در لیست هزینه‌ها ==================== */

.expense-prepayments {
    margin-top: 0.4rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.85rem;
    color: #b0b0b0;
}

.prepay-badge {
    background: rgba(78, 204, 163, 0.12);
    color: #4ecca3;
    border: 1px solid rgba(78, 204, 163, 0.3);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.8rem;
}

/* ==================== ریسپانسیو دو ستون ==================== */

@media (max-width: 900px) {
    .expense-layout {
        grid-template-columns: 1fr;
    }
    .expense-divider {
        width: 100%;
        height: 1px;
        min-height: unset;
        margin: 1.5rem 0;
    }
}

/* ==================== پیش‌پرداخت کشویی ==================== */

.prepayment-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: 'Vazirmatn', sans-serif;
    color: inherit;
    gap: 0.5rem;
}

.prepayment-toggle-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.prepayment-arrow {
    color: #bb86fc;
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.prepayment-arrow.open {
    transform: rotate(180deg);
}

.prepayment-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 0;
    margin-top: 0;
    /* اطمینان از نمایش صحیح روی iOS */
    -webkit-overflow-scrolling: touch;
}

.prepayment-body.open {
    max-height: 1200px;
    opacity: 1;
    margin-top: 1rem;
}

/* ==================== پرداخت‌کننده جداگانه ==================== */
.payer-wrapper {
    margin-bottom: 0.5rem;
}

.payer-row {
    background: rgba(187, 134, 252, 0.07);
    border: 1px solid rgba(187, 134, 252, 0.25);
    border-radius: 10px;
    padding: 0.8rem 1rem;
}

.payer-label {
    color: #bb86fc;
    font-weight: 600;
    white-space: nowrap;
}

/* پیش‌پرداخت داخل کارت افراد */
.prepayment-box-inside {
    margin-top: 1.5rem;
}

/* ==================== پیش‌پرداخت تأیید شده ==================== */
.prepay-confirmed-box {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.prepay-confirmed-rows {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.prepay-confirmed-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: rgba(187,134,252,0.07);
    border-radius: 8px;
}

.prepay-amount-val {
    color: #bb86fc;
    font-weight: 600;
}

.prepay-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    background: rgba(78,204,163,0.1);
    border: 1px solid rgba(78,204,163,0.3);
    border-radius: 8px;
    color: #4ecca3;
    font-size: 0.95rem;
}

.prepay-total-row strong {
    font-size: 1rem;
}

.btn-confirm-prepay {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, #4ecca3, #27ae60);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-confirm-prepay:hover { opacity: 0.88; }

.btn-edit-prepay {
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid rgba(187,134,252,0.4);
    border-radius: 8px;
    color: #bb86fc;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    align-self: flex-start;
}

.btn-edit-prepay:hover { background: rgba(187,134,252,0.1); }

/* ==================== ویرایش هزینه ==================== */
.expense-actions {
    display: flex;
    gap: 0.4rem;
    align-items: flex-start;
    flex-shrink: 0;
}

.btn-edit-exp {
    background: none;
    border: 1px solid rgba(187,134,252,0.35);
    border-radius: 6px;
    color: #bb86fc;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: background 0.2s;
}

.btn-edit-exp:hover { background: rgba(187,134,252,0.1); }

.expense-item.editing {
    border: 1px solid #bb86fc;
    background: rgba(187,134,252,0.06);
}

/* ==================== سطر خلاصه جدول ==================== */
.summary-row td { padding: 0 !important; }
.summary-cell {
    background: rgba(187,134,252,0.07) !important;
    padding: 0.8rem 1rem !important;
    font-size: 0.88rem;
    color: #c0c0c0;
    border-radius: 6px;
    line-height: 2;
}

/* ردیف کارت مادر در جدول */
.master-card-row td {
    background: rgba(187, 134, 252, 0.08);
    border-bottom: 2px solid rgba(187, 134, 252, 0.25);
    font-size: 0.9rem;
    color: #bb86fc;
}

/* ==================== لوگو هدر ==================== */
.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ==================== لوگو فوتر ==================== */
.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-img-footer {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 8px;
    opacity: 0.9;
    flex-shrink: 0;
}

/* ==================== ریسپانسیو لوگو ==================== */
@media (max-width: 768px) {
    .logo-img {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .logo h1 {
        font-size: 1.2rem;
    }

    .logo-img-footer {
        width: 26px;
        height: 26px;
    }
}

/* ==================== بخش FAQ ==================== */
.faq-section {
    padding: 5rem 0;
    background: rgba(10, 10, 30, 0.4);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    background: rgba(22, 33, 62, 0.6);
    border: 1px solid rgba(187, 134, 252, 0.2);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.faq-item:hover {
    border-color: rgba(187, 134, 252, 0.4);
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    background: none;
    border: none;
    color: #e0e0e0;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    transition: color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.faq-question:hover { color: #bb86fc; }

.faq-question[aria-expanded="true"] { color: #bb86fc; }

.faq-arrow {
    font-size: 0.75rem;
    color: #bb86fc;
    flex-shrink: 0;
    transition: transform 0.3s;
    display: inline-block;
}

.faq-question[aria-expanded="true"] .faq-arrow {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.3s ease;
    padding: 0 1.5rem;
}

.faq-answer.open {
    max-height: 300px;
    padding: 0 1.5rem 1.2rem;
}

.faq-answer p {
    color: #b0b0b0;
    line-height: 2;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .faq-question { font-size: 0.9rem; padding: 1rem 1.1rem; }
    .faq-answer { padding: 0 1.1rem; }
    .faq-answer.open { padding: 0 1.1rem 1rem; }
}
