@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@700&family=Marhey:wght@400;600;700&display=swap');

@font-face {
    font-family: 'Kalameh';
    src: url('fonts/Kalameh-Regular.woff2') format('woff2'),
         url('fonts/Kalameh-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Kalameh';
    src: url('fonts/Kalameh-Bold.woff2') format('woff2'),
         url('fonts/Kalameh-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Marhey', 'Comic Neue', 'Kalameh', sans-serif;
    background: #FAFDFD;
    direction: rtl;
    overflow-x: hidden;
    color: #000000;
}

.quiz-builder-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ==========================================================================
   Builder Header - Hand-Drawn Sketch Theme
   ========================================================================== */
.builder-header {
    background: #FFFFFF;
    padding: 12px 25px;
    border-bottom: 3.5px solid #000000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0px 4px 0px #000000;
    z-index: 10;
}

.builder-header h1 {
    flex: 1;
    text-align: center;
    font-size: 26px;
    color: #0E5E6F;
    -webkit-text-stroke: 1px #000000;
    font-family: 'Kalameh', sans-serif;
    font-weight: 900;
}

/* Header Action Buttons Styling */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    direction: rtl;
}

.btn-header-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 10px 20px !important;
    font-family: 'Kalameh', sans-serif !important;
    font-size: 14px !important;
    font-weight: bold !important;
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    outline: none !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease !important;
    box-shadow: 3px 3px 0px #000000 !important;
    text-decoration: none !important;
    line-height: 1.4 !important;
}

.btn-header-action .btn-icon {
    font-size: 16px;
    display: inline-block;
    line-height: 1;
}

.btn-header-action:hover {
    transform: translate(-2px, -2px) !important;
    box-shadow: 5px 5px 0px #000000 !important;
}

.btn-header-action:active {
    transform: translate(0, 0) !important;
    box-shadow: 1px 1px 0px #000000 !important;
}

/* Button Colors - Flat without gradients */
.btn-save-quiz {
    background: #0E5E6F !important;
    color: #FFFFFF !important;
}

.btn-save-quiz:hover {
    background: #0B4A56 !important;
}

.btn-preview {
    background: #FFFFFF !important;
    color: #000000 !important;
}

.btn-preview:hover {
    background: #F0F7F8 !important;
}

.btn-generate-pdf {
    background: #0E5E6F !important;
    color: #FFFFFF !important;
}

.btn-generate-pdf:hover {
    background: #0B4A56 !important;
}

.builder-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ==========================================================================
   Sidebar Workspace
   ========================================================================== */
.sidebar {
    width: 260px;
    background: #FFFFFF;
    border-left: 3.5px solid #000000;
    padding: 20px;
    overflow-y: auto;
}

.sidebar h3 {
    margin-bottom: 18px;
    color: #0E5E6F;
    font-size: 18px;
    font-family: 'Kalameh', sans-serif;
    font-weight: 900;
    border-bottom: 2.5px solid #000000;
    padding-bottom: 8px;
}

.elements-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.element-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #FFFFFF;
    border: 3px solid #000000;
    border-radius: 10px;
    cursor: grab;
    box-shadow: 3px 3px 0px #000000;
    font-weight: bold;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.element-item:hover {
    background: #F0F7F8;
    transform: translate(-3px, -3px);
    box-shadow: 5px 5px 0px #000000;
}

.element-item:active {
    cursor: grabbing;
    transform: translate(0, 0);
    box-shadow: 1px 1px 0px #000000;
}

.element-icon {
    font-size: 20px;
}

/* ==========================================================================
   Main Builder Content Area
   ========================================================================== */
.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #FAFDFD;
}

.header-settings {
    background: #FFFFFF;
    padding: 25px;
    border: 3.5px solid #000000;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    margin-bottom: 30px;
    box-shadow: 6px 6px 0px #000000;
    position: relative;
}

/* Corner Hatching Accent Lines */
.header-settings::before {
    content: '';
    position: absolute;
    top: 10px;
    right: 12px;
    width: 14px;
    height: 3px;
    background: #000000;
    transform: rotate(-40deg);
}

.header-settings h2 {
    margin-bottom: 20px;
    color: #0E5E6F;
    font-size: 22px;
    font-family: 'Kalameh', sans-serif;
    font-weight: 900;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #000000;
    font-weight: bold;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 3px solid #000000;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Kalameh', sans-serif;
    direction: rtl;
    background: #FFFFFF;
    color: #000000;
    box-shadow: 3px 3px 0px #000000;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0E5E6F;
    box-shadow: 5px 5px 0px #000000;
}

/* Questions Section */
.questions-section {
    background: #FFFFFF;
    padding: 25px;
    border: 3.5px solid #000000;
    border-radius: 255px 15px 225px 15px/15px 225px 15px 255px;
    box-shadow: 6px 6px 0px #000000;
    position: relative;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    color: #0E5E6F;
    font-size: 22px;
    font-family: 'Kalameh', sans-serif;
    font-weight: 900;
}

.btn-add-question {
    padding: 10px 20px;
    background: #0E5E6F;
    color: #FFFFFF;
    border: 3px solid #000000;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    font-family: 'Kalameh', sans-serif;
    box-shadow: 3px 3px 0px #000000;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn-add-question:hover {
    background: #0B4A56;
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0px #000000;
}

.btn-add-question:active {
    transform: translate(0, 0);
    box-shadow: 1px 1px 0px #000000;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.question-item {
    background: #FFFFFF;
    border: 3px solid #000000;
    border-radius: 12px;
    padding: 20px;
    cursor: move;
    box-shadow: 4px 4px 0px #000000;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.question-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0px #000000;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-number {
    font-weight: 900;
    color: #0E5E6F;
    font-size: 16px;
}

.question-actions {
    display: flex;
    gap: 10px;
}

.btn-edit, .btn-delete {
    padding: 6px 14px;
    border: 2.5px solid #000000;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    font-family: 'Kalameh', sans-serif;
    box-shadow: 2px 2px 0px #000000;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-edit {
    background: #FFFFFF;
    color: #000000;
}

.btn-edit:hover {
    background: #F0F7F8;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #000000;
}

.btn-delete {
    background: #FFFFFF;
    color: #000000;
}

.btn-delete:hover {
    background: #FFEBEB;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px #000000;
}

.question-preview {
    color: #000000;
    line-height: 1.6;
    font-weight: bold;
}

.question-type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #0E5E6F;
    color: #FFFFFF;
    border: 2px solid #000000;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-right: 10px;
}

/* Modal Window Redesign */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    overflow: auto;
}

.modal-content {
    background: #FFFFFF;
    margin: 50px auto;
    padding: 0;
    border: 3.5px solid #000000;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    box-shadow: 8px 8px 0px #000000;
    display: flex;
    flex-direction: column;
}

.preview-modal {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 3px solid #000000;
    background: #FAFDFD;
}

.modal-header h3 {
    color: #0E5E6F;
    font-size: 20px;
    font-family: 'Kalameh', sans-serif;
    font-weight: 900;
}

.modal-close {
    background: #FFFFFF;
    border: 2.5px solid #000000;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 10px;
    box-shadow: 2px 2px 0px #000000;
    transition: transform 0.15s ease;
}

.modal-close:hover {
    transform: scale(1.1);
}

/* Comprehensive Quiz Mobile Responsive */
@media (max-width: 768px) {
    .header-settings,
    .questions-section {
        padding: 16px !important;
        border-radius: 16px !important;
        box-shadow: 4px 4px 0px #000000 !important;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .btn-add-question {
        width: 100%;
        text-align: center;
    }

    .question-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .question-actions {
        width: 100%;
        display: flex;
        justify-content: flex-end;
        gap: 8px;
    }

    .modal-content {
        width: 95% !important;
        margin: 15px auto !important;
        max-height: 92vh !important;
        border-radius: 14px !important;
    }

    .modal-header {
        padding: 12px 16px !important;
    }

    .modal-body {
        padding: 15px !important;
    }
}
