/* ===== Global Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* ===== Container ===== */
.container {
    max-width: 80%;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ===== Header ===== */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* ===== Content Area ===== */
.content {
    padding: 30px;
}

/* ===== Accordion Level 1 (Chapter) ===== */
.accordion-chapter {
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.accordion-chapter-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 25px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1.3em;
    font-weight: bold;
}

.accordion-chapter-header:hover {
    background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
    transform: translateX(-3px);
}

.accordion-chapter-header.active {
    background: linear-gradient(135deg, #1a252f 0%, #2c3e50 100%);
}

.accordion-chapter-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: #ecf0f1;
    padding: 0 20px;
}

.accordion-chapter-content.active {
    max-height: 10000px;
    padding: 20px;
}

/* ===== Accordion Level 2 (Question) ===== */
.accordion-question {
    margin-bottom: 12px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.accordion-question-header {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1.1em;
    font-weight: 600;
}

.accordion-question-header:hover {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    transform: translateX(-3px);
}

.accordion-question-header.active {
    background: linear-gradient(135deg, #21618c 0%, #2980b9 100%);
}

.accordion-question-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    background: white;
    padding: 0 15px;
}

.accordion-question-content.active {
    max-height: 8000px;
    padding: 20px 15px;
}

/* ===== Question Content Sections ===== */
.question-answer {
    margin-bottom: 20px;
    padding: 15px;
    background: #e8f4f8;
    border-right: 4px solid #3498db;
    border-radius: 5px;
}

.question-answer h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.question-answer p {
    color: #34495e;
    line-height: 1.8;
}

/* ===== Calculations List ===== */
.calculations-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff3cd;
    border-right: 4px solid #ffc107;
    border-radius: 5px;
}

.calculations-section h4 {
    color: #856404;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.calculations-section ul {
    list-style: none;
    padding-right: 0;
}

.calculations-section li {
    padding: 8px 0;
    color: #856404;
    font-weight: 500;
    border-bottom: 1px dashed #ffc107;
}

.calculations-section li:last-child {
    border-bottom: none;
}

.calculations-section li:before {
    content: "◄ ";
    color: #ffc107;
    font-weight: bold;
    margin-left: 8px;
}

/* ===== Conditions List ===== */
.conditions-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #d4edda;
    border-right: 4px solid #28a745;
    border-radius: 5px;
}

.conditions-section h4 {
    color: #155724;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.conditions-section ol {
    padding-right: 20px;
    color: #155724;
}

.conditions-section li {
    padding: 5px 0;
    font-weight: 500;
}

/* ===== Tables ===== */
.table-section {
    margin-bottom: 20px;
    overflow-x: auto;
}

.table-section h4 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.1em;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.data-table thead {
    background: linear-gradient(135deg, #5f27cd 0%, #341f97 100%);
    color: white;
}

.data-table th {
    padding: 12px;
    text-align: center;
    font-weight: 600;
}

.data-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #ecf0f1;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Important Note ===== */
.important-note {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8d7da;
    border-right: 4px solid #dc3545;
    border-radius: 5px;
}

.important-note h4 {
    color: #721c24;
    margin-bottom: 8px;
    font-size: 1.05em;
}

.important-note p {
    color: #721c24;
    font-weight: 500;
}

/* ===== Conclusion ===== */
.conclusion-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #cfe2ff;
    border-right: 4px solid #0d6efd;
    border-radius: 5px;
}

.conclusion-section h4 {
    color: #084298;
    margin-bottom: 8px;
    font-size: 1.05em;
}

.conclusion-section p {
    color: #084298;
    font-weight: 500;
}

/* ===== Accordion Level 3 (Examples) ===== */
.examples-container {
    margin-top: 15px;
}

.examples-container h4 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.1em;
}

.accordion-example {
    margin-bottom: 10px;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.accordion-example-header {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
    padding: 12px 18px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1em;
    font-weight: 500;
}

.accordion-example-header:hover {
    background: linear-gradient(135deg, #7f8c8d 0%, #95a5a6 100%);
    transform: translateX(-2px);
}

.accordion-example-header.active {
    background: linear-gradient(135deg, #5d6d7e 0%, #7f8c8d 100%);
}

.accordion-example-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8f9fa;
    padding: 0 12px;
}

.accordion-example-content.active {
    max-height: 2000px;
    padding: 15px 12px;
}

/* ===== Example Steps ===== */
.example-steps {
    margin-bottom: 15px;
}

.example-steps h5 {
    color: #495057;
    margin-bottom: 10px;
    font-size: 1em;
}

.example-steps ol {
    padding-right: 20px;
    color: #495057;
}

.example-steps li {
    padding: 6px 0;
    font-family: 'Courier New', monospace;
    background: white;
    margin-bottom: 5px;
    padding: 8px;
    border-radius: 4px;
    border-right: 3px solid #6c757d;
}

/* ===== Example Result ===== */
.example-result {
    padding: 12px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-right: 4px solid #28a745;
    border-radius: 5px;
    font-weight: bold;
    color: #155724;
    font-size: 1.1em;
    text-align: center;
}

/* ===== Arrow Icons ===== */
.arrow {
    transition: transform 0.3s ease;
    font-size: 1.2em;
}

.arrow.active {
    transform: rotate(180deg);
}

/* ===== Additional Info Link ===== */
.additional-info {
    margin-top: 15px;
    padding: 12px;
    background: #e7f3ff;
    border-right: 4px solid #0d6efd;
    border-radius: 5px;
}

.additional-info a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
}

.additional-info a:hover {
    text-decoration: underline;
}

/* ===== Responsive Design ===== */
@media (max-width: 1200px) {
    .container {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 95%;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .accordion-chapter-header {
        font-size: 1.1em;
        padding: 15px 18px;
    }

    .accordion-question-header {
        font-size: 1em;
        padding: 12px 15px;
    }

    .accordion-example-header {
        font-size: 0.95em;
        padding: 10px 12px;
    }
}

/* ===== Smooth Scrolling ===== */
html {
    scroll-behavior: smooth;
}

/* ===== Special Cases Section ===== */
.special-cases {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff0f6;
    border-right: 4px solid #e91e63;
    border-radius: 5px;
}

.special-cases h4 {
    color: #880e4f;
    margin-bottom: 12px;
    font-size: 1.1em;
}

.special-case {
    background: white;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-right: 2px solid #e91e63;
}

.special-case h5 {
    color: #ad1457;
    margin-bottom: 8px;
}

.special-case ul {
    list-style: none;
    padding-right: 0;
}

.special-case li {
    padding: 4px 0;
    color: #880e4f;
}

.special-case li:before {
    content: "● ";
    color: #e91e63;
    font-weight: bold;
    margin-left: 5px;
}
