/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #d4d4d4;
    background-color: #1e1e1e;
    height: 100vh;
    overflow: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

/* Header Styles */
.app-header {
    background-color: #252526;
    padding: 0 10px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1a1a1a;
}

.app-title {
    font-size: 12px;
    font-weight: 400;
    color: #cccccc;
}

/* Toolbar Styles */
.app-toolbar {
    background-color: #333333;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid #1a1a1a;
}

.toolbar-button {
    background: transparent;
    border: none;
    color: #cccccc;
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toolbar-button:hover {
    background-color: #2a2d2e;
}

.toolbar-button.active {
    background-color: #37373d;
}

.toolbar-button .icon {
    font-size: 16px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background-color: #555555;
    margin: 0 10px;
}

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

/* Sidebar Styles */
.sidebar {
    background-color: var(--bg-dark);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    width: 250px;
    overflow-y: auto;
}

.sidebar-header {
    padding: 10px;
    font-weight: bold;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.tree-view {
    margin-top: 10px;
}

.folder {
    margin-bottom: 8px;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-color);
}

.folder-header:hover {
    background-color: var(--bg-hover);
}

.folder-icon {
    margin-right: 6px;
    color: var(--accent-color);
    display: flex;
    align-items: center;
}

.folder-name {
    flex: 1;
    font-weight: 500;
}

.item-count {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-left: 4px;
}

.folder-content {
    margin-left: 16px;
    padding-left: 8px;
    border-left: 1px dashed var(--border-color);
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    margin-top: 2px;
    color: var(--text-color);
}

.tree-item:hover {
    background-color: var(--bg-hover);
}

.tree-item.active {
    background-color: var(--bg-active);
    color: var(--accent-color);
}

.tree-item-icon {
    margin-right: 6px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

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

.tree-item-delete {
    opacity: 0;
    color: var(--danger-color);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.tree-item:hover .tree-item-delete {
    opacity: 1;
}

.empty-message {
    color: var(--text-muted);
    font-style: italic;
    padding: 10px;
    text-align: center;
}

/* Editor Container */
.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
    overflow: hidden;
}

/* Editor Tabs */
.editor-tabs {
    display: flex;
    background-color: #252526;
    border-bottom: 1px solid #1a1a1a;
    height: 32px;
}

.editor-tab {
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #969696;
    border-right: 1px solid #1a1a1a;
    cursor: pointer;
}

.editor-tab.active {
    background-color: #1e1e1e;
    color: #ffffff;
    border-top: 1px solid #1a1a1a;
    border-bottom: 1px solid #1e1e1e;
    margin-bottom: -1px;
}

.editor-tab-close {
    margin-left: 5px;
    font-size: 16px;
    opacity: 0.7;
}

.editor-tab-close:hover {
    opacity: 1;
}

/* Editor Content */
.editor-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

/* Grid Layout for Side-by-Side Panels */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    height: 100%;
}

.creator-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.creator-panel .panel-content {
    flex: 1;
    overflow-y: auto;
}

.output-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.output-panel .tab-content {
    flex: 1;
    overflow-y: auto;
}

/* Panel Styles */
.panel {
    background-color: #252526;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
}

.panel-header {
    background-color: #2d2d2d;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
}

.panel-content {
    padding: 15px;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-col {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    color: #cccccc;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 8px 10px;
    background-color: #3c3c3c;
    border: 1px solid #1a1a1a;
    color: #d4d4d4;
    border-radius: 3px;
    font-size: 13px;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #007fd4;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cccccc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 30px;
}

/* Button Styles */
button {
    cursor: pointer;
    border: none;
    font-size: 13px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #0e639c;
    color: #ffffff;
    padding: 8px 12px;
}

.btn-primary:hover {
    background-color: #1177bb;
}

.btn-danger {
    background-color: #a1260d;
    color: #ffffff;
    padding: 8px 12px;
}

.btn-danger:hover {
    background-color: #bf2c0d;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    background-color: #3c3c3c;
    color: #d4d4d4;
}

.btn-sm:hover {
    background-color: #4c4c4c;
}

/* Question Section */
.question-section {
    background-color: #2d2d2d;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow: hidden;
}

.question-header {
    background-color: #333333;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1a1a1a;
    cursor: pointer;
}

.question-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.collapse-icon {
    transition: transform 0.2s;
    display: inline-block;
    font-size: 12px;
}

.question-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.question-section.collapsed .question-content {
    display: none;
}

.question-content {
    padding: 15px;
}

.question-header span {
    font-weight: 500;
}

/* Input with Action */
.input-with-action {
    display: flex;
    gap: 10px;
}

.input-with-action input {
    flex: 1;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #2d2d2d;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    z-index: 1;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
}

.dropdown-content a {
    color: #d4d4d4;
    padding: 8px 10px;
    text-decoration: none;
    display: block;
    cursor: pointer;
}

.dropdown-content a:hover {
    background-color: #3c3c3c;
}

.show {
    display: block;
}

/* List Items and Resources */
.list-item-inputs,
.resource-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.list-item-inputs input:first-child,
.resource-inputs input:first-child {
    flex: 2;
}

.list-item-inputs input:nth-child(2),
.resource-inputs input:nth-child(2) {
    flex: 3;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid #1a1a1a;
}

.tab {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 13px;
    color: #cccccc;
}

.tab:hover {
    background-color: #2a2d2e;
}

.tab.active {
    background-color: #37373d;
    color: #ffffff;
    border-bottom: 2px solid #007fd4;
    margin-bottom: -1px;
}

.tab-content {
    display: none;
    padding: 15px;
}

.tab-content.active {
    display: block;
}

/* Preview and Code Output */
#previewOutput {
    background-color: #1e1e1e;
    padding: 15px;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    min-height: 200px;
}

.code-output,
.json-output {
    background-color: #1e1e1e;
    padding: 15px;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    white-space: pre-wrap;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    color: #d4d4d4;
    overflow-x: auto;
    min-height: 200px;
}

/* Copy Button */
.copy-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #3c3c3c;
    color: #d4d4d4;
    padding: 4px 8px;
    font-size: 12px;
    z-index: 1;
}

.copy-button:hover {
    background-color: #4c4c4c;
}

/* Add Resource Button */
.add-button {
    background-color: rgba(14, 99, 156, 0.7);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    border: 2px solid #0e639c;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.scan-button {
    background-color: rgba(14, 99, 156, 0.7);
    color: #ffffff;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    border: 2px solid #0e639c;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.add-button:hover {
    background-color: rgba(17, 119, 187, 0.8);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.add-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.add-button::before {
    content: "+";
    font-weight: bold;
    margin-right: 4px;
}

/* Success animation for add-button */
@keyframes successPulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7); }
    50% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

@keyframes checkmarkAppear {
    0% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

.add-button.success {
    background-color: rgba(40, 167, 69, 0.7);
    border-color: #28a745;
    animation: successPulse 1.5s ease-in-out;
}

.add-button.success::before {
    content: "✓";
    animation: checkmarkAppear 0.5s ease-in-out;
}

/* Success Message */
.success-message {
    display: none;
    position: absolute;
    top: 5px;
    right: 50px;
    background-color: #28a745;
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 3px;
    z-index: 1;
}

/* Helper Text */
.helper-text {
    font-size: 12px;
    color: #999999;
    margin-top: 5px;
}

/* Note */
.note {
    background-color: #2d2d2d;
    border-left: 3px solid #007fd4;
    padding: 10px;
    margin-bottom: 15px;
    font-size: 13px;
}

/* Match Results */
.match-results {
    margin-top: 10px;
    font-size: 13px;
}

.match-item {
    padding: 5px;
    margin-bottom: 5px;
    background-color: #2d2d2d;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
}

.match-item:hover {
    background-color: #333333;
}

.match-title {
    font-weight: 500;
    color: #cccccc;
}

.match-url {
    font-size: 12px;
    color: #007fd4;
    word-break: break-all;
}

.match-score {
    font-size: 11px;
    color: #999999;
}

/* Status Bar */
.status-bar {
    height: 22px;
    background-color: #007fd4;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    color: #ffffff;
}

.status-item {
    margin-right: 15px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 576px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid #1a1a1a;
    }
    
    .input-with-action {
        flex-direction: column;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.2s;
}

.modal-content {
    position: relative;
    background-color: #252526;
    margin: 10% auto;
    width: 400px;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.2s;
}

.modal-header {
    padding: 12px 15px;
    background-color: #333333;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1a1a1a;
}

.modal-title {
    font-weight: 500;
    color: #ffffff;
}

.modal-close {
    color: #cccccc;
    font-size: 20px;
    cursor: pointer;
}

.modal-close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 15px;
}

.modal-footer {
    padding: 12px 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid #1a1a1a;
}

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

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Lucide Icons Styling */
[data-lucide] {
    width: 16px;
    height: 16px;
    stroke-width: 0.5;
}

/* Status Bar */
.status-bar {
    height: 22px;
    background-color: #007fd4;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 12px;
    color: #ffffff;
}

.status-item {
    margin-right: 15px;
}

/* Collapsible sections for resources and links */
.collapsible-section {
    margin-bottom: 15px;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
    background-color: #2a2a2a;
}

.collapsible-header {
    background-color: #333;
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #fff;
}

.collapsible-header:hover {
    background-color: #444;
}

.collapsible-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.collapsible-content.expanded {
    max-height: 2000px;
    padding: 15px;
    transition: all 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Grid layout for resources and links */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.grid-item {
    background-color: #333;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    color: #ddd;
}

.grid-item-title {
    font-size: 0.9rem;
    margin-bottom: 8px;
    word-break: break-word;
}

.grid-item-actions {
    margin-top: auto;
    display: flex;
    gap: 5px;
}

/* Badges for resource counts */
.resource-count {
    background-color: #007bff;
    color: white;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-left: 5px;
}

/* Toggle icon animation */
.toggle-icon {
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.toggle-icon.expanded {
    transform: rotate(180deg);
}

.link-all-button {
    margin-left: 10px;
    padding: 2px 8px;
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.link-all-button:hover {
    background-color: #3a5ce5;
}

.link-all-button.success {
    background-color: #28a745;
}

/* Link Toolbar */
.link-toolbar {
    position: fixed;
    background-color: #252526;
    border: 1px solid #1a1a1a;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 4px;
    z-index: 1000;
    display: flex;
    gap: 4px;
}

.link-toolbar button {
    background-color: #3c3c3c;
    color: #d4d4d4;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.link-toolbar button:hover {
    background-color: #4c4c4c;
}

.editable {
    min-height: 100px;
    background-color: #1e1e1e;
    border: 1px solid #3c3c3c;
    border-radius: 3px;
    padding: 8px;
    color: #d4d4d4;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    outline: none;
}

.editable:focus {
    border-color: #007fd4;
}

.editable a {
    color: #4a9eff;
    text-decoration: none;
}

.editable a:hover {
    text-decoration: underline;
}