/* متغيرات الألوان */
:root {
    --primary-color: #006837;
    --secondary-color: #008542;
    --background-light: #ffffff;
    --text-light: #1f2937;
    --border-light: #e5e7eb;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --header-height: 70px;
}

[data-theme="dark"] {
    --primary-color: #008542;
    --secondary-color: #00a651;
    --background-light: #1f2937;
    --text-light: #f3f4f6;
    --border-light: #374151;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--background-light);
    color: var(--text-light);
    transition: all 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--header-height);
    line-height: 1.6;
}

/* الهيدر */
header {
    background-color: var(--primary-color);
    padding: 0.5rem 0;
    box-shadow: var(--shadow-light);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
}

.header-content > div {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0px;
    text-align: center;
    font-family: 'Cairo', sans-serif;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 50px;
    width: auto;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

/* القائمة الجانبية */
.side-menu {
    position: fixed;
    right: -100%;
    top: 0;
    width: 300px;
    height: 100vh;
    background-color: var(--background-light);
    box-shadow: var(--shadow-light);
    transition: right 0.3s ease;
    z-index: 999;
    overflow-y: auto;
    padding: calc(var(--header-height) + 1rem) 1rem 1rem 1rem;
}

.side-menu.active {
    right: 0;
}

.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.menu-close {
    background: var(--primary-color);
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu-close:hover {
    background-color: var(--secondary-color);
    transform: scale(1.1);
}

.menu-items {
    list-style: none;
}

.menu-item {
    margin-bottom: 1rem;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
}

.menu-link:hover {
    background-color: var(--border-light);
}

.menu-link.current {
    background-color: var(--primary-color);
    color: white;
}

.menu-link i {
    margin-left: 0.75rem;
    width: 20px;
    text-align: center;
}

.submenu {
    list-style: none;
    margin-right: 2rem;
    margin-top: 0.5rem;
    display: none;
}

.submenu.active {
    display: block;
}

/* المحتوى الرئيسي */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-light);
}

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

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

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* لوحات الإعدادات والنتائج */
.settings-panel,
.output-panel {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: var(--shadow-light);
}

.settings-panel h2,
.output-panel h3 {
    margin-bottom: 25px;
    color: var(--primary-color);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* النماذج */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background-color: var(--background-light);
    color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 104, 55, 0.1);
}

.form-group textarea {
    height: 80px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #7f8c8d;
    font-size: 12px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* أزرار */
.btn-generate {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 104, 55, 0.4);
}

.btn-copy {
    padding: 8px 16px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-copy:hover {
    background: #229954;
    transform: translateY(-1px);
}

/* قسم المعاينة */
.preview-section {
    margin-bottom: 30px;
}

.preview-container {
    border: 2px dashed #bdc3c7;
    border-radius: 8px;
    padding: 20px;
    background: #f8f9fa;
    min-height: 300px;
}

.preview-container iframe {
    border-radius: 8px;
}

/* أقسام الكود */
.code-section,
.css-section {
    margin-bottom: 30px;
}

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

.code-container {
    background: #2c3e50;
    border-radius: 8px;
    overflow: hidden;
}

.code-container pre {
    margin: 0;
    padding: 20px;
    color: #ecf0f1;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
}

.code-container code {
    color: #e74c3c;
}

/* الإشعارات */
.notification {
    position: fixed;
    top: calc(var(--header-height) + 20px);
    right: 20px;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-light);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notification.show {
    transform: translateX(0);
}

/* رسائل النجاح */
.success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px 15px;
    border-radius: 5px;
    border: 1px solid #c3e6cb;
    margin-top: 10px;
    display: none;
}

.success-message.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* الفوتر */
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    margin-top: auto;
}

/* تحسينات للألوان */
input[type="color"] {
    height: 45px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* تحسين شكل الأرقام */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* تصميم متجاوب */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
    }

    .container {
        padding: 1rem 0.75rem;
    }

    .page-header {
        padding: 2rem 1rem;
    }

    .page-header h1 {
        font-size: 2em;
    }

    .header-title {
        font-size: 1.2rem;
    }

    .settings-panel,
    .output-panel {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .side-menu {
        width: 85%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        padding: 1.5rem 0.75rem;
    }
    
    .page-header h1 {
        font-size: 1.8em;
    }
}

/* تنسيق خاص للنصوص العربية */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .code-container pre {
    text-align: left;
    direction: ltr;
}

/* النمط الليلي */
[data-theme="dark"] .settings-panel,
[data-theme="dark"] .output-panel {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .preview-container {
    background: #374151;
    border-color: #4b5563;
}

h3 {
    margin-bottom: 10px;
}