/* Modern Dark BarTender / NiceLabel Professional UI System */
:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --bg-surface: #334155;
    --bg-canvas-wrapper: #090d16;
    --border: #475569;
    --border-light: #64748b;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --cyan: #06b6d4;
    --emerald: #10b981;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --radius: 6px;
    --shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'IBM Plex Sans', -apple-system, sans-serif;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header & Ribbon Toolbar */
.navbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 52px;
}

.brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-badge {
    background: linear-gradient(135deg, var(--accent), var(--cyan));
    color: #ffffff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
}

.ribbon-toolbar {
    background: #172033;
    border-bottom: 1px solid var(--border);
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow-x: auto;
    font-size: 0.8rem;
}

.ribbon-group {
    display: flex;
    align-items: center;
    gap: 6px;
    border-right: 1px solid var(--border);
    padding-right: 12px;
}

/* App Container Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebars */
.sidebar-left, .sidebar-right {
    width: 300px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 12px;
}

.sidebar-right {
    border-right: none;
    border-left: 1px solid var(--border);
    width: 320px;
}

.sidebar-section {
    margin-bottom: 16px;
    background: var(--bg-dark);
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.sidebar-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Workspace Canvas Area */
.workspace {
    flex: 1;
    background: var(--bg-canvas-wrapper);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.canvas-toolbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
}

.canvas-container {
    flex: 1;
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(var(--bg-surface) 1px, transparent 0);
    background-size: 16px 16px;
}

/* Rulers */
.ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background: #0f172a;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.ruler-h {
    position: absolute;
    top: 0;
    left: 24px;
    right: 0;
    height: 24px;
    background: #1e293b;
    border-bottom: 1px solid var(--border);
    z-index: 9;
}

.ruler-v {
    position: absolute;
    top: 24px;
    left: 0;
    bottom: 0;
    width: 24px;
    background: #1e293b;
    border-right: 1px solid var(--border);
    z-index: 9;
}

.canvas-wrapper {
    position: relative;
    box-shadow: var(--shadow);
    background: #ffffff;
    border-radius: 2px;
}

/* Status Bar */
.status-bar {
    height: 28px;
    background: #0f172a;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Tool Buttons Grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.btn {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn:hover {
    background: var(--border-light);
    color: #ffffff;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--emerald);
    border-color: var(--emerald);
    color: #ffffff;
}

.btn-block {
    width: 100%;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 10px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.form-input, .form-select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 8px;
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-row {
    display: flex;
    gap: 8px;
}

.form-row .form-group {
    flex: 1;
}

/* Data Pills & Badges */
.variable-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.badge-var {
    background: #1e293b;
    border: 1px solid #475569;
    color: var(--cyan);
    font-size: 0.7rem;
    font-family: monospace;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: grab;
}

.badge-var:hover {
    background: var(--accent);
    color: #ffffff;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 480px;
    max-width: 90%;
    box-shadow: var(--shadow);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Object List */
.object-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.object-list-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--radius);
    background: var(--bg-dark);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.8rem;
    gap: 8px;
    transition: all 0.15s ease;
}

.object-list-item:hover {
    background: var(--bg-surface);
}

.object-list-item.selected {
    background: rgba(37, 99, 235, 0.2);
    border-color: var(--accent);
}

/* Tabs */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.tab-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: var(--text);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border: 1px solid var(--accent);
    z-index: 100;
}
.resize-handle.nw-resize { cursor: nw-resize; top: -4px; left: -4px; }
.resize-handle.n-resize { cursor: n-resize; top: -4px; left: calc(50% - 4px); }
.resize-handle.ne-resize { cursor: ne-resize; top: -4px; right: -4px; }
.resize-handle.w-resize { cursor: w-resize; top: calc(50% - 4px); left: -4px; }
.resize-handle.e-resize { cursor: e-resize; top: calc(50% - 4px); right: -4px; }
.resize-handle.sw-resize { cursor: sw-resize; bottom: -4px; left: -4px; }
.resize-handle.s-resize { cursor: s-resize; bottom: -4px; left: calc(50% - 4px); }
.resize-handle.se-resize { cursor: se-resize; bottom: -4px; right: -4px; }

/* Context Menu */
.context-menu {
    position: absolute;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px;
    min-width: 160px;
    box-shadow: var(--shadow);
    z-index: 2000;
}

.context-menu-item {
    padding: 6px 12px;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s ease;
}

.context-menu-item:hover {
    background: var(--accent);
    color: #ffffff;
}

.separator {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.color-picker-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border);
    cursor: pointer;
    display: inline-block;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.form-group-inline .form-label {
    margin-bottom: 0;
    white-space: nowrap;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.tooltip {
    position: absolute;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 8px;
    font-size: 0.75rem;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: var(--shadow);
}

.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-surface);
    color: var(--text);
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
    z-index: 3000;
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.splitter {
    width: 4px;
    background: var(--border);
    cursor: col-resize;
    transition: background 0.15s ease;
    z-index: 50;
}
.splitter:hover {
    background: var(--accent);
}

.progress-bar {
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Specific elements */
.pay-card, .sbp-qr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--bg-surface);
}

/* Focus outline */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Responsive sidebar */
@media (max-width: 1024px) {
    .sidebar-left, .sidebar-right {
        width: 250px;
    }
}
@media (max-width: 768px) {
    .sidebar-left, .sidebar-right {
        width: 200px;
    }
}
