/* فونت Vazir - فرض می‌کنیم فایل‌های فونت در کنار فایل HTML قرار دارند */
@font-face {
    font-family: 'Vazir';
    src: url('fonts/vazir-v27.2.2/Vazir-Regular.eot');
    src: url('fonts/vazir-v27.2.2/Vazir-Regular.eot?#iefix') format('embedded-opentype'),
            url('fonts/vazir-v27.2.2/Vazir-Regular.woff2') format('woff2'),
            url('fonts/vazir-v27.2.2/Vazir-Regular.woff') format('woff'),
            url('fonts/vazir-v27.2.2/Vazir-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('fonts/vazir-v27.2.2/Vazir-Bold.eot');
    src: url('fonts/vazir-v27.2.2/Vazir-Bold.eot?#iefix') format('embedded-opentype'),
            url('fonts/vazir-v27.2.2/Vazir-Bold.woff2') format('woff2'),
            url('fonts/vazir-v27.2.2/Vazir-Bold.woff') format('woff'),
            url('fonts/vazir-v27.2.2/Vazir-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('fonts/vazir-v27.2.2/Vazir-Medium.eot');
    src: url('fonts/vazir-v27.2.2/Vazir-Medium.eot?#iefix') format('embedded-opentype'),
            url('fonts/vazir-v27.2.2/Vazir-Medium.woff2') format('woff2'),
            url('fonts/vazir-v27.2.2/Vazir-Medium.woff') format('woff'),
            url('fonts/vazir-v27.2.2/Vazir-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('fonts/vazir-v27.2.2/Vazir-Light.eot');
    src: url('fonts/vazir-v27.2.2/Vazir-Light.eot?#iefix') format('embedded-opentype'),
            url('fonts/vazir-v27.2.2/Vazir-Light.woff2') format('woff2'),
            url('fonts/vazir-v27.2.2/Vazir-Light.woff') format('woff'),
            url('fonts/vazir-v27.2.2/Vazir-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazir', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1200px;
}

h1, h2 {
    text-align: center;
}

h1 {
    color: #2c3e50;
    /* margin-bottom: 20px; */
    font-size: 24px;
}

h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
}

h2 a {
    color: #2c3e50;
    text-decoration: none;
}

.description {
    text-align: center;
    margin-bottom: 20px;
    color: #555;
    line-height: 1.6;
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    font-size: 14px;
}

.controls-panel {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.size-selector {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.size-btn {
    padding: 10px 20px;
    background-color: #e0e0e0;
    color: #555;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.size-btn.active {
    background-color: #1a5f7a;
    color: white;
}

.edit-form {
    display: none;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #444;
    font-size: 14px;
}

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

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.form-actions button {
    padding: 10px 20px;
    font-size: 14px;
}

/* استایل صفحه A4 و A5 */
.a4-page, .a5-page {
    background-color: white;
    margin: 0 auto;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    page-break-after: always;
}

.a4-page {
    width: 21cm;
    height: 29.7cm;
}

.a5-page {
    width: 14.8cm;
    height: 21cm;
}

/* هدر سربرگ */
.letterhead-header {
    padding: 20px 30px 10px;
    border-bottom: 2px solid #1a5f7a;
    position: relative;
}

.company-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.logo-section {
    flex: 0 0 auto;
    text-align: center;
}

.logo-placeholder {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 5px;
    color: white;
    font-weight: 700;
    transition: all 0.3s ease;
}

.company-details {
    flex: 1;
    padding-right: 30px;
    text-align: right;
}

.company-name {
    font-weight: 700;
    color: #1a5f7a;
    margin-bottom: 5px;
}

.company-slogan {
    color: #2a9d8f;
    margin-bottom: 15px;
    font-weight: 500;
}

.logo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.company-description {
    line-height: 1.7;
    color: #444;
    margin-bottom: 20px;
    text-align: justify;
}

/* بخش اطلاعات تماس در پابرگ */
.letterhead-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px 30px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
}

.contact-info {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-left: 20px;
    margin-bottom: 8px;
}

.contact-icon {
    color: #1a5f7a;
    margin-left: 6px;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* محتوای صفحه */
.page-content {
    padding: 30px;
    line-height: 1.8;
    text-align: justify;
    height: calc(100% - 180px);
    overflow: hidden;
}

.content-title {
    color: #1a5f7a;
    margin-bottom: 20px;
    text-align: right;
}

/* دکمه‌های کنترل */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

button {
    padding: 10px 20px;
    background-color: #1a5f7a;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

button:hover {
    background-color: #2a9d8f;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

#printBtn {
    background-color: #2a9d8f;
}

.button-icon {
    margin-left: 6px;
}

/* طراحی واکنش‌گرا */
@media (max-width: 1200px) {
    .a4-page, .a5-page {
        width: 100%;
        height: auto;
        min-height: 29.7cm;
    }

    .a5-page {
        min-height: 21cm;
    }
}

@media (max-width: 768px) {
    .company-info {
        flex-direction: column;
        align-items: center;
    }

    .company-details {
        padding-right: 0;
        text-align: center;
        margin-top: 15px;
    }

    .contact-info {
        justify-content: center;
    }

    .form-row {
        flex-direction: column;
    }
}

@media print {
    body {
        background-color: white;
        padding: 0;
    }

    .description, .controls, h1, .controls-panel {
        display: none;
    }

    .a4-page, .a5-page {
        box-shadow: none;
        margin: 0;
    }

    .a4-page {
        width: 21cm;
        height: 29.7cm;
    }

    .a5-page {
        width: 14.8cm;
        height: 21cm;
    }

    .letterhead-header {
        position: relative !important;
    }

    .letter-header-info {
        display: block !important;
    }

    .a5-page .company-info {
        flex-direction: row !important;
        align-items: flex-start !important;
        text-align: right !important;
    }

    .a5-page .company-details {
        padding-right: 20px !important;
        text-align: right !important;
        margin-top: 0 !important;
        width: auto !important;
    }

    .a5-page .logo-section {
        margin-bottom: 0 !important;
        width: auto !important;
        text-align: center !important;
    }

    .a5-page .logo-placeholder {
        margin: 0 auto 5px !important;
    }

    .page-content div {
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
    }
}

/* آیکون‌های SVG */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    stroke-width: 0;
    stroke: currentColor;
    fill: currentColor;
}

.hidden {
    display: none;
}
