/* File Explorer Styles */

.files-area {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.files-header h4 {
    margin: 0;
    color: #333;
    font-size: 14px;
}

.create-file-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.create-file-btn:hover {
    background: #218838;
}

.file-explorer {
    flex: 1;
    display: flex;
    min-height: 0;
}

.file-tree {
    width: 250px;
    border-right: 1px solid #e0e0e0;
    background: #fafafa;
    overflow-y: auto;
    padding: 10px;
}

.file-placeholder {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
    line-height: 1.4;
}

.file-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.file-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.current-file-name {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.file-editor-actions {
    display: flex;
    gap: 8px;
}

.save-file-btn, .close-file-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.save-file-btn {
    background: #007bff;
    color: white;
}

.save-file-btn:hover {
    background: #0056b3;
}

.close-file-btn {
    background: #6c757d;
    color: white;
}

.close-file-btn:hover {
    background: #545b62;
}

.file-content-editor {
    flex: 1;
    border: none;
    padding: 15px;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background: #fafafa;
}

/* File Tree Styles */
.file-tree-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    margin: 1px 0;
    font-size: 13px;
    transition: background 0.2s;
}

.file-tree-item:hover {
    background: #e9ecef;
}

.file-tree-item.active {
    background: #007bff;
    color: white;
}

.file-tree-item.directory {
    font-weight: 500;
}

.file-tree-item .icon {
    margin-right: 6px;
    font-size: 12px;
    min-width: 16px;
}

.file-tree-item .name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-tree-item .actions {
    opacity: 0;
    display: flex;
    gap: 4px;
    transition: opacity 0.2s;
}

.file-tree-item:hover .actions {
    opacity: 1;
}

.file-action-btn {
    background: none;
    border: none;
    padding: 2px 4px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 10px;
    color: #666;
}

.file-action-btn:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
}

.file-tree-item.active .file-action-btn {
    color: rgba(255,255,255,0.8);
}

.file-tree-item.active .file-action-btn:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* Directory collapse/expand */
.file-tree-item.directory.collapsed + .file-tree-children {
    display: none;
}

.file-tree-children {
    margin-left: 16px;
    border-left: 1px dotted #ccc;
    padding-left: 8px;
}

/* File type icons */
.file-icon-html::before { content: "🌐"; }
.file-icon-css::before { content: "🎨"; }
.file-icon-javascript::before { content: "⚡"; }
.file-icon-json::before { content: "📄"; }
.file-icon-markdown::before { content: "📝"; }
.file-icon-text::before { content: "📄"; }
.directory-icon::before { content: "📁"; }
.directory-icon.open::before { content: "📂"; }

/* Multi-file mode toggle */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
}

.toggle-checkbox {
    position: relative;
    width: 40px;
    height: 20px;
    appearance: none;
    background: #ccc;
    border-radius: 20px;
    transition: background 0.3s;
    cursor: pointer;
}

.toggle-checkbox:checked {
    background: #007bff;
}

.toggle-checkbox::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-checkbox:checked::before {
    transform: translateX(20px);
}

.toggle-text {
    font-weight: 500;
}

/* Create File Modal */
.create-file-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.create-file-modal-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    width: 400px;
    max-width: 90vw;
}

.create-file-modal-header {
    margin-bottom: 15px;
}

.create-file-modal-header h3 {
    margin: 0;
    color: #333;
}

.create-file-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-group input, .form-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

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

.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-btn-primary {
    background: #007bff;
    color: white;
}

.modal-btn-primary:hover {
    background: #0056b3;
}

.modal-btn-secondary {
    background: #6c757d;
    color: white;
}

.modal-btn-secondary:hover {
    background: #545b62;
}

/* Responsive design */
@media (max-width: 768px) {
    .file-explorer {
        flex-direction: column;
    }

    .file-tree {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
}