body {
    font-family: Arial, sans-serif;
    direction: rtl;
    text-align: right;
    background-color: #f4f4f4;
    margin: 0;
    padding: 20px;
}

.container, .login-container {
    max-width: 1200px;
    margin: auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

h2, h3 {
    text-align: center;
    color: #333;
}

input, select, button {
    padding: 8px;
    margin: 5px 0;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box;
    width: 100%;
}

.form-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.form-group label {
    min-width: 120px;
    margin-left: 10px;
    font-weight: bold;
    white-space: nowrap;
}

.form-group input, .form-group select {
    flex: 1;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
    padding: 10px;
}

button {
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 5px;
}

button:hover {
    background-color: #218838;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 10px;
    text-align: center;
    border: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    width: 90%;
    max-width: 1400px;
    border-radius: 8px;
    position: relative;
    overflow-y: auto;
    max-height: 80vh;
}

.close {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    cursor: pointer;
    color: #aaa;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.error {
    color: red;
    text-align: center;
}

#companions table {
    margin-top: 20px;
    width: 100%;
}

#companions th {
    background-color: #e9ecef;
}

.receipt {
    border: 1px solid #ddd;
    padding: 20px;
    margin: 20px 0;
    border-radius: 8px;
}

.receipt h3 {
    margin-top: 0;
}

.back-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 10px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 5px;
}

.back-btn:hover {
    background-color: #0056b3;
}

.bed-grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 5px;
    margin-top: 10px;
}

.bed-cell {
    border: 1px solid #ddd;
    text-align: center;
    padding: 12px;
    box-sizing: border-box;
    min-width: 70px;
    min-height: 90px;
    font-size: 18px;
}

.bed-cell .date-info {
    font-size: 14px;
    font-weight: bold;
    line-height: 1.4;
    margin-top: 5px;
    color: #333;
}

.occupied {
    background-color: red;
    color: white;
    cursor: not-allowed;
}

.available {
    background-color: green;
    color: white;
}

.partially-available {
    background-color: gray;
    color: white;
    cursor: not-allowed;
}

.bed-cell input[type="checkbox"] {
    margin: 0 auto;
    display: block;
}

.gender-section {
    margin-bottom: 20px;
}

.gender-section h3 {
    margin: 0 0 10px 0;
}

#bedsSummaryTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#bedsSummaryTable th, #bedsSummaryTable td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

#bedsSummaryTable th {
    background-color: #f8f9fa;
}

.menu-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
}

.menu-bar button, .menu-bar a {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    margin: 0 5px;
}

.menu-bar button:hover, .menu-bar a:hover {
    background-color: #0056b3;
}

@media screen and (max-width: 1200px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bed-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media screen and (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group label {
        min-width: 100px;
    }
    .bed-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .menu-bar {
        flex-wrap: wrap;
        justify-content: center;
    }
    .menu-bar button, .menu-bar a {
        margin: 5px;
    }
}

/* استایل‌های تب‌ها */
.tabs {
    display: flex;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.tab-button {
    padding: 10px 20px;
    background-color: #f4f4f4;
    color: #333;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    margin-left: 5px;
}

.tab-button:hover {
    background-color: #e0e0e0;
    color: #333;
}

.tab-button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.tab-button.active:hover {
    background-color: #0056b3;
    color: white;
}

.tab-content {
    display: none;
}

/* استایل دکمه‌های کوچک‌تر */
.small-button {
    padding: 6px 12px;
    font-size: 14px;
    width: auto;
    display: inline-block;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.small-button:hover {
    background-color: #c82333;
}

/* استایل جدول لیست زائران */
#pilgrimListTable {
    margin-top: 10px;
}

#pilgrimListTable th, #pilgrimListTable td {
    padding: 8px;
    text-align: center;
    border: 1px solid #ddd;
}

#pilgrimListTable th {
    background-color: #e9ecef;
}

/* استایل نمودارها */
.charts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.chart-box {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

/* استایل کارت و چاپ */
@page {
    size: A5 portrait;
    margin: 0.5cm 0.3cm;
}

.cards-container {
    height: auto;
    display: flex;
    flex-direction: column;
    page-break-inside: avoid;
    margin: 0.5cm 0;
}

.card {
    width: 14.8cm;
    height: 6.1cm;
    background-color: white;
    position: relative;
    border: 2px solid black;
    box-sizing: border-box;
    margin: 0 0 0.4cm 0;
    overflow: hidden;
    page-break-inside: avoid;
}

.card:first-child {
    margin-top: 0;
}

.card:last-child {
    margin-bottom: 0;
}

.header {
    border-bottom: 2px solid black;
    color: black;
    padding: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo {
    display: none;
}

.custom-text {
    border: 1px dashed black;
    padding: 4px;
    font-size: 9px;
    margin: 4px 0;
    background-color: white;
    text-align: right;
    direction: rtl;
    unicode-bidi: plaintext;
}

.content {
    display: flex;
    height: calc(100% - 25px - 15px - 20px);
    font-size: 11px;
    color: black;
}

.right-section {
    width: 60%;
    padding: 4px;
    border-left: 1px dashed black;
}

.left-section {
    width: 40%;
    padding: 4px;
}

.row {
    display: flex;
    margin-bottom: 3px;
}

.label {
    color: #333;
    width: 65px;
    flex-shrink: 0;
}

.value {
    font-weight: bold;
    color: black;
}

.section-title {
    border-bottom: 1px solid #333;
    color: #333;
    padding: 2px 4px;
    margin: 4px -4px;
    font-weight: bold;
    font-size: 10px;
    text-align: center;
}

.barcode {
    text-align: center;
    margin-top: 8px;
    font-family: monospace;
    font-size: 9px;
    color: black;
}

.footer {
    position: absolute;
    bottom: 15px;
    width: 100%;
    text-align: center;
    font-size: 8px;
    color: #666;
    border-top: 1px solid #333;
    padding: 2px 0;
    background-color: white;
}

.additional-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    font-size: 8px;
    color: #666;
    padding: 2px 0;
    background-color: white;
    border-top: 1px dashed #333;
}

.print-btn {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.print-btn:hover {
    background-color: #218838;
}

@media print {
    body {
        margin: 0;
        padding: 0;
        background: none;
    }
    .container {
        width: 14.8cm;
        height: auto;
        padding: 0;
        box-shadow: none;
    }
    .cards-container {
        margin: 0.5cm 0;
        page-break-inside: avoid;
    }
    .card {
        width: 14.8cm;
        height: 6.1cm;
        margin: 0 0 0.4cm 0;
        border: 2px solid black;
    }
    .card:first-child {
        margin-top: 0;
    }
    .card:last-child {
        margin-bottom: 0;
    }
    .print-btn, .back-btn {
        display: none;
    }
    .custom-text {
        text-align: right;
        direction: rtl;
        unicode-bidi: plaintext;
    }
}