:root {
    --bg-app: #0f172a;
    --bg-panel: #1e293b;
    --bg-card: #0f172a;
    --bg-input: #1e293b;
    --border-color: #334155;
    --border-focus: #38bdf8;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --c-docker: #2496ed;
    --c-danger: #ef4444;
    --c-warn: #f59e0b;
    --c-success: #10b981;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-ui);
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* UI Components */
.btn {
    font-family: var(--font-ui);
    cursor: pointer;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--c-docker);
    color: #fff;
}

.btn-primary:hover {
    background-color: #1a7ecc;
}

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.btn-text {
    background: transparent;
    color: var(--c-docker);
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.btn-text:hover {
    background: rgba(36, 150, 237, 0.1);
}

input,
select {
    font-family: var(--font-ui);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus,
select:focus {
    border-color: var(--border-focus);
}

input::placeholder {
    color: #475569;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.topbar {
    height: 60px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.docker-icon {
    color: var(--c-docker);
}

.badge {
    font-size: 0.65rem;
    background: var(--c-docker);
    color: #fff;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    vertical-align: super;
    margin-left: 4px;
}

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

.header-actions label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Workspace */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

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

/* Editor Pane */
.editor-pane {
    flex: 1;
    border-right: 1px solid var(--border-color);
    background: var(--bg-app);
    overflow-y: auto;
    padding: 2rem;
}

.services-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.services-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.add-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    min-width: 150px;
    z-index: 100;
    overflow: hidden;
}

.dropdown-menu.hidden {
    display: none;
}

.dropdown-menu button {
    background: transparent;
    border: none;
    color: var(--text-main);
    text-align: left;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.85rem;
}

.dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.services-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Service Card */
.service-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.svc-title-edit {
    display: flex;
    align-items: center;
}

.input-svc-name {
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--c-docker);
    padding: 0;
    border-radius: 0;
    width: 200px;
}

.input-svc-name:focus {
    border-bottom-color: var(--c-docker);
    box-shadow: none;
}

.btn-remove-svc {
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
}

.btn-remove-svc:hover {
    color: var(--c-danger);
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group.row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.array-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.array-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.array-header label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.array-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.array-input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.btn-remove-array {
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
}

.btn-remove-array:hover {
    color: var(--c-danger);
}


/* Code Pane */
.code-pane {
    flex: 0 0 450px;
    background: var(--bg-panel);
}

.validation-bar {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.status.success {
    color: var(--c-success);
}

.status.error {
    color: var(--c-danger);
}

.status.warning {
    color: var(--c-warn);
}

.linter-warnings {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lint-msg {
    font-size: 0.8rem;
    color: var(--c-warn);
    display: flex;
    align-items: flex-start;
    gap: 0.25rem;
    background: rgba(245, 158, 11, 0.1);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}

.lint-msg.error {
    color: var(--c-danger);
    background: rgba(239, 68, 68, 0.1);
}

.code-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.code-header h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-mono);
}

#yaml-output {
    flex: 1;
    background: transparent;
    border: none;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    padding: 1.5rem;
    resize: none;
    outline: none;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #fff;
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Resizing */
@media (max-width: 1000px) {
    .workspace {
        flex-direction: column;
        overflow-y: auto;
    }

    .editor-pane,
    .code-pane {
        flex: none;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .code-pane {
        height: 500px;
    }
}