/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    padding: 0;
    margin: 0;
}

/* App layout with sidebar */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 18px;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

.nav-heading {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: block;
}

.nav-item a {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.nav-item a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active a {
    background: #1976d2;
    color: white;
}

.main-content {
    flex: 1;
    padding: 20px;
    overflow-x: auto;
}

/* Container and layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    align-items: start;
}

/* Header styles */
header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

h1 {
    color: #333;
    font-size: 24px;
}

/* Button styles */
.action-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
}

.btn-primary:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-danger {
    background: #d32f2f;
    color: white;
}

.btn-danger:hover {
    background: #b71c1c;
}

.back-btn {
    background: #f0f0f0;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.back-btn:hover {
    background: #e0e0e0;
}

/* Form and input styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #1976d2;
}

.input-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.input-field:focus {
    outline: none;
    border-color: #1976d2;
}

.input-with-helpers {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

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

.btn-insert-var {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

.btn-insert-var:hover {
    background: #dee2e6;
}

/* Card and panel styles */
.info-card {
    background: white;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    overflow: hidden;
}

.editor-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
}

.preview-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    position: sticky;
    top: 20px;
}

/* Toast notification styles */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
    cursor: pointer;
}

.toast:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.toast-success .toast-icon {
    background: #4caf50;
    color: white;
}

.toast-error .toast-icon {
    background: #f44336;
    color: white;
}

.toast-info .toast-icon {
    background: #2196f3;
    color: white;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.toast-message {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    width: 20px;
    height: 20px;
}

.toast-close:hover {
    color: #666;
}

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

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

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

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.modal-btn-cancel {
    background: #f0f0f0;
    color: #333;
}

.modal-btn-cancel:hover {
    background: #e0e0e0;
}

.modal-btn-delete {
    background: #d32f2f;
    color: white;
}

.modal-btn-delete:hover {
    background: #b71c1c;
}

.modal-btn-delete:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

.modal-btn-assign {
    background: #1976d2;
    color: white;
}

.modal-btn-assign:hover {
    background: #1565c0;
}

.modal-btn-assign:disabled {
    background: #e0e0e0;
    color: #999;
    cursor: not-allowed;
}

/* Status indicators */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-online {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-offline {
    background: #ffebee;
    color: #c62828;
}

.status-updating {
    background: #f5f5f5;
    color: #757575;
}

.status-indicator {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-indicator.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-indicator.failed {
    background: #ffebee;
    color: #c62828;
}

.status-indicator.overdue {
    background: #fff3e0;
    color: #e65100;
}

.status-indicator.pending {
    background: #e3f2fd;
    color: #1565c0;
}

.status-indicator.not-applicable {
    background: #f5f5f5;
    color: #757575;
}

.status-indicator.not-supported {
    background: #fff8e1;
    color: #f57c00;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

tr:hover {
    background: #f8f9fa;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.info-table tr:last-child td {
    border-bottom: none;
}

.info-table td:first-child {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    width: 200px;
    background: #f8f9fa;
}

.info-table td:last-child {
    font-size: 14px;
    color: #333;
    word-break: break-all;
}

.value-with-copy {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    background: #f0f0f0;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: #e0e0e0;
}

.copy-btn:active {
    background: #d0d0d0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* Link styles */
.item-link {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
}

.item-link:hover {
    text-decoration: underline;
}

/* Registry entry styles */
.registry-entry {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    position: relative;
}

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

.entry-number {
    font-weight: 600;
    color: #666;
    font-size: 13px;
}

.entry-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.entry-field {
    display: flex;
    flex-direction: column;
}

.entry-field.full-width {
    grid-column: 1 / -1;
}

.entry-field label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.entry-field input,
.entry-field select,
.entry-field textarea {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
}

.entry-field input:focus,
.entry-field select:focus,
.entry-field textarea:focus {
    outline: none;
    border-color: #1976d2;
}

.entry-field textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Courier New', monospace;
}

.entry-field input.error,
.entry-field textarea.error {
    border-color: #d32f2f;
    background-color: #ffebee;
}

.remove-entry-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.remove-entry-btn:hover {
    background: #d32f2f;
}

/* Import modal styles */
.import-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.import-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
}

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

/* Drop zone styles */
.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover {
    border-color: #1976d2;
    background: #f5f9ff;
}

.drop-zone.dragover {
    border-color: #1976d2;
    background: #e3f2fd;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.drop-zone-content svg {
    width: 64px;
    height: 64px;
    color: #999;
}

.drop-zone-content p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Import status styles */
.import-status {
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.import-status.success {
    background: #e8f5e9;
    border: 1px solid #4caf50;
    color: #2e7d32;
}

.import-status.error {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
}

/* Progress bar styles */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: #1976d2;
    transition: width 0.3s ease;
}

/* Icon button styles */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #666;
    transition: color 0.2s;
}

.btn-icon:hover {
    color: #1976d2;
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
    
    .preview-panel {
        position: static;
    }
}

/* Variable dropdown styles */
.var-dropdown {
    position: relative;
    display: inline-block;
}

.var-dropdown-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

.var-dropdown-btn:hover {
    background: #dee2e6;
}

.var-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    min-width: 140px;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    margin-top: 2px;
}

.var-dropdown.open .var-dropdown-menu {
    display: block;
}

.var-dropdown-group {
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
}

.var-dropdown-group:last-child {
    border-bottom: none;
}

.var-dropdown-header {
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.var-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 6px 10px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: #333;
}

.var-dropdown-menu button:hover {
    background: #f8f9fa;
}
