:root {
    --primary-color: #004d2b;
    --primary-dark: #008542;
    --primary-light: #004d2b;
    --secondary-color: #00a651;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --info-color: #06b6d4;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --header-height: 60px;
    --sidebar-width: 320px;
    --toolbar-height: 55px;
    --tabs-height: 40px;
    --statusbar-height: 30px;
    
    --border-radius: 6px;
    --transition: all 0.2s ease-in-out;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
}

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

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    overflow: hidden;
}

/* Header */
.header {
    height: var(--header-height);
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn, .menu-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
}

.header-btn:hover, .menu-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow: hidden;
    z-index: 999;
}

.sidebar.collapsed {
    transform: translateX(100%);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sidebar-header h3 {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* تحسين الأزرار */
.sidebar-actions .btn {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    justify-content: center;
    min-height: 36px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sidebar-actions .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    transition: all 0.3s ease;
    z-index: 1;
}

.sidebar-actions .btn:hover::before {
    width: 100%;
}

.sidebar-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.sidebar-actions .btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sidebar-actions .btn.btn-primary {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.sidebar-actions .btn.btn-success {
    background: linear-gradient(135deg, #10b981, #34d399);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.sidebar-actions .btn.btn-success:hover {
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.sidebar-actions .btn.btn-info {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.sidebar-actions .btn.btn-info:hover {
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
}

.sidebar-actions .btn i {
    position: relative;
    z-index: 2;
}

.sidebar-actions .btn .btn-text {
    position: relative;
    z-index: 2;
    display: inline;
}

/* File Tree */
.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.file-item, .folder-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-right: 3px solid transparent;
    position: relative;
}

.file-item:hover, .folder-item:hover {
    background-color: var(--bg-tertiary);
}

.file-item.active {
    background-color: var(--primary-color);
    color: white;
    border-right-color: var(--primary-dark);
}

.file-item.modified {
    font-style: italic;
}

.file-item.modified::after {
    content: '●';
    color: var(--accent-color);
    font-size: 0.8rem;
    margin-right: 0.25rem;
}

.folder-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-secondary);
    transition: var(--transition);
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-toggle:hover {
    color: var(--text-primary);
}

.folder-content {
    margin-right: 1rem;
    border-right: 1px dotted var(--border-color);
}

.file-actions {
    display: none;
    gap: 0.25rem;
    margin-right: auto;
}

.file-item:hover .file-actions,
.folder-item:hover .file-actions {
    display: flex;
}

.file-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: var(--transition);
    font-size: 0.8rem;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-action-btn:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.file-action-btn.delete:hover {
    background-color: var(--danger-color);
    color: white;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    height: 100%;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state .small {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

/* Project Actions */
.project-actions {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Open Files Tabs */
.open-files-tabs {
    min-height: var(--tabs-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.open-files-tabs::-webkit-scrollbar {
    height: 4px;
}

.open-files-tabs::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.open-files-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.tabs-container {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.file-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    min-width: 0;
    max-width: 200px;
    position: relative;
}

.file-tab:hover {
    background-color: var(--bg-primary);
}

.file-tab.active {
    background-color: var(--bg-primary);
    border-bottom-color: var(--bg-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.modified-indicator {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.8rem;
}

.tab-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-right: -0.25rem;
}

.tab-close:hover {
    background-color: var(--danger-color);
    color: white;
}

.close-all-tabs {
    background: none;
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 32px;
}

.close-all-tabs:hover {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

/* Editor Toolbar */
.editor-toolbar {
    min-height: var(--toolbar-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.toolbar-left {
    flex: 1;
    min-width: 0;
}

.current-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbar-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-controls {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.version-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.5rem;
    background-color: var(--bg-tertiary);
    border-radius: var(--border-radius);
    min-width: 30px;
    text-align: center;
}

.toolbar-right {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
}

.mobile-upload-buttons {
    display: none;
    gap: 0.25rem;
}

/* Find and Replace Panel */
.find-replace-panel {
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}

.find-replace-content {
    max-width: 800px;
    margin: 0 auto;
}

.find-replace-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.input-group input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.find-replace-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.find-options {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.find-options label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Editor Container */
.editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#codeEditor {
    width: 100%;
    height: 100%;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    border: none;
    outline: none;
    resize: none;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 1rem;
}

.CodeMirror {
    height: 100% !important;
    font-size: 14px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    line-height: 1.5;
    direction: ltr;
}

.CodeMirror.rtl-mode {
    direction: rtl;
}

/* Status Bar */
.status-bar {
    height: var(--statusbar-height);
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-left, .status-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Buttons - تحسين شامل */
.btn {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    justify-content: center;
    min-height: 36px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    transform: translateY(0);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
    z-index: 1;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn:active {
    transform: translateY(-1px);
}

.btn.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    min-height: 32px;
    border-radius: 6px;
}

.btn-text {
    display: inline;
    position: relative;
    z-index: 2;
}

.btn i {
    position: relative;
    z-index: 2;
}

.btn.btn-block {
    width: 100%;
}

.btn.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: none;
}

.btn.btn-outline:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn.btn-success {
    background: linear-gradient(135deg, var(--success-color), #34d399);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn.btn-success:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #fbbf24);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn.btn-warning:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn.btn-info {
    background: linear-gradient(135deg, var(--info-color), #22d3ee);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.25);
}

.btn.btn-info:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.btn.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #f87171);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn.btn-danger:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.35);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn:disabled::before {
    display: none;
}

/* Header buttons enhancement */
.header-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    max-height: 90%;
    width: 600px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tab-button {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
    color: var(--text-secondary);
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.tab-button.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-button:hover {
    background-color: var(--bg-tertiary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

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

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

/* Project List */
.project-list, .template-list {
    max-height: 300px;
    overflow-y: auto;
}

.project-item, .template-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    transition: var(--transition);
    cursor: pointer;
}

.project-item:hover, .template-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.project-info h4, .template-info h4 {
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.project-info p, .template-info p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.project-actions-inline, .template-actions-inline {
    display: flex;
    gap: 0.25rem;
}

.template-manager-actions {
    margin-bottom: 1rem;
    text-align: center;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-light);
}

.loading-spinner p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 1rem);
    right: 1rem;
    z-index: 2500;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-md);
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
}

.toast.success {
    border-right: 4px solid var(--success-color);
}

.toast.error {
    border-right: 4px solid var(--danger-color);
}

.toast.warning {
    border-right: 4px solid var(--warning-color);
}

.toast.info {
    border-right: 4px solid var(--info-color);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    margin-right: auto;
    padding: 0.25rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.toast-close:hover {
    background-color: var(--bg-tertiary);
}

/* Preview Container */
.preview-container {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-primary);
    z-index: 1500;
    display: flex;
    flex-direction: column;
}

.preview-header {
    height: var(--toolbar-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.preview-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

#previewFrame {
    flex: 1;
    width: 100%;
    border: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 300px;
        --toolbar-height: auto;
    }
    
    .sidebar {
        position: fixed;
        top: var(--header-height);
        right: -100%;
        height: calc(100vh - var(--header-height));
        z-index: 1500;
        box-shadow: var(--shadow-lg);
        transition: right 0.3s ease-in-out;
    }
    
    .sidebar.show {
        right: 0;
    }
    
    .sidebar.collapsed {
        transform: none;
        right: -100%;
    }
    
    .main-content {
        width: 100%;
    }
    
    .header-title {
        font-size: 1rem;
    }
    
    .header-title span {
        display: none;
    }
    
    .toolbar-center {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .editor-controls {
        justify-content: center;
        width: 100%;
    }
    
    .mobile-upload-buttons {
        display: flex;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    .toolbar-right .btn-text {
        display: none;
    }
    
    .editor-toolbar {
        padding: 0.5rem;
    }
    
    .btn.btn-sm {
        min-width: 36px;
        justify-content: center;
    }
    
    .version-info {
        order: -1;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 85vh;
    }
    
    .tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-button {
        white-space: nowrap;
        min-width: 120px;
    }
    
    .find-replace-inputs {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .input-group {
        min-width: 100%;
    }
    
    .find-replace-buttons {
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .find-options {
        justify-content: center;
    }
    
    .open-files-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .file-tab {
        min-width: 120px;
        max-width: 150px;
    }
    
    /* تحسين الأزرار للهاتف */
    .sidebar-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .sidebar-actions .btn {
        flex: 1;
        min-width: 0;
        padding: 0.6rem 0.8rem;
    }
    
    .sidebar-actions .btn .btn-text {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 0.5rem;
    }
    
    .header-title {
        font-size: 0.9rem;
    }
    
    .btn.btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        min-width: 32px;
    }
    
    .editor-toolbar {
        padding: 0.25rem;
    }
    
    .sidebar-actions .btn {
        padding: 0.5rem 0.6rem;
    }
    
    .sidebar-actions .btn .btn-text {
        font-size: 0.7rem;
    }
    
    .file-tab {
        min-width: 100px;
        max-width: 120px;
    }
    
    .tab-name {
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .header,
    .sidebar,
    .editor-toolbar,
    .status-bar,
    .modal,
    .toast-container,
    .loading-overlay,
    .open-files-tabs {
        display: none !important;
    }
    
    .main-content {
        margin-top: 0;
        height: auto;
    }
    
    .editor-container {
        height: auto;
    }
    
    #codeEditor,
    .CodeMirror {
        height: auto !important;
        max-height: none !important;
    }
}

/* Dark Theme Specific */
[data-theme="dark"] .CodeMirror {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

[data-theme="dark"] .CodeMirror .CodeMirror-gutters {
    background-color: var(--bg-secondary);
    border-right-color: var(--border-color);
}

[data-theme="dark"] .CodeMirror .CodeMirror-cursor {
    border-left-color: var(--text-primary);
}

[data-theme="dark"] .CodeMirror .CodeMirror-selected {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* CodeMirror RTL Support */
.CodeMirror-rtl {
    direction: rtl;
}

.CodeMirror-rtl .CodeMirror-scroll {
    direction: rtl;
}

/* File Type Icons */
.file-icon.html { color: #e34c26; }
.file-icon.css { color: #1572b6; }
.file-icon.js { color: #f7df1e; }
.file-icon.json { color: #000000; }
.file-icon.md { color: #083fa1; }
.file-icon.txt { color: #6b7280; }
.file-icon.xml { color: #ff6600; }
.file-icon.php { color: #777bb4; }
.file-icon.python { color: #3776ab; }
.file-icon.java { color: #007396; }

[data-theme="dark"] .file-icon.json { color: #ffffff; }

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.bounce-in {
    animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Folder States */
.folder-item.open .folder-toggle i {
    transform: rotate(90deg);
}

.folder-content {
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}
.CodeMirror-scroll {
    margin-right: -40px;
}
button.btn.btn-success.btn-block {
    margin-bottom: 1rem;
}