/* --- CSS VARIABLES & THEME --- */
:root {
    --bg-page: #eef2f6;
    --bg-surface: #ffffff;
    --bg-subtle: #f8fafc;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --brand-50: #eff6ff;
    --brand-100: #dbeafe;
    --brand-200: #bfdbfe;
    --brand-500: #3b82f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
}

/* --- MODE DEPENDENT VISIBILITY --- */
body.mode-standard .pro-feature-section,
body.mode-standard .pro-feature-block {
    opacity: 0.5;
    filter: grayscale(0.8);
    pointer-events: none;
    position: relative;
}

body.mode-standard .pro-feature-section::after {
    content: 'PRO Režim Vypnutý';
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.65);
    backdrop-filter: blur(1px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    border-radius: 0.5rem;
    z-index: 10;
}

body.mode-pro .pro-feature-section,
body.mode-pro .pro-feature-block {
    opacity: 1;
    filter: none;
    pointer-events: auto;
}

/* --- CUSTOM SCROLLBARS --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- DRAG & DROP UTILS & GHOST STYLES --- */
.dots-handle, .section-drag-handle {
    cursor: grab;
}
.dots-handle:active, .section-drag-handle:active {
    cursor: grabbing;
}

.sortable-ghost-section {
    opacity: 0.35;
    background-color: var(--brand-50) !important;
    border: 2px dashed var(--brand-500) !important;
    border-radius: 0.75rem;
}

.sortable-ghost-field {
    opacity: 0.35;
    background-color: var(--brand-50) !important;
    border: 2px dashed var(--brand-500) !important;
    border-radius: 0.5rem;
}

.sortable-ghost-palette {
    opacity: 0.5;
    background-color: var(--brand-100) !important;
    border: 2px dashed var(--brand-600) !important;
}

.sortable-drag-palette {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    background-color: var(--bg-surface);
    border-color: var(--brand-500);
}

/* --- BASE LAYOUT --- */
body.app-body {
    background-color: var(--bg-page);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

.app-header {
    height: 3.5rem;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
    flex-shrink: 0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 0.75rem;
    gap: 0.75rem;
}

.app-sidebar {
    width: 20rem;
    background-color: var(--bg-surface);
    border-radius: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

#inspector-sidebar {
    width: 35rem;
}

.app-main-canvas {
    flex: 1;
    background-color: var(--bg-surface);
    border-radius: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* --- BUTTONS --- */
.btn-icon {
    color: var(--text-light);
    padding: 0.25rem;
    transition: color 0.15s ease;
}
.btn-icon:hover {
    color: var(--text-muted);
}

.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: 0.5rem;
    color: var(--brand-600);
    background-color: var(--brand-50);
    border: 1px solid var(--brand-200);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-secondary:hover {
    background-color: var(--brand-100);
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 1.25rem;
    background-color: var(--brand-600);
    color: #ffffff;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.15s ease;
}
.btn-primary:hover {
    background-color: var(--brand-700);
}
.btn-primary:active {
    transform: scale(0.95);
}

/* --- SWITCH TOGGLE --- */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #334155;
    background-color: var(--bg-subtle);
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.switch-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.switch-slider {
    width: 2.25rem;
    height: 1.25rem;
    background-color: #cbd5e1;
    border-radius: 9999px;
    position: relative;
    transition: background-color 0.2s ease;
}
.switch-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 9999px;
    transition: transform 0.2s ease;
}
input:checked + .switch-slider {
    background-color: var(--brand-600);
}
input:checked + .switch-slider::after {
    transform: translateX(100%);
    border-color: #ffffff;
}

/* --- PALETTE COMPONENT --- */
.palette-category-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.625rem;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    text-align: center;
}

.palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    transition: all 0.15s ease;
    cursor: grab;
    min-height: 4rem;
}
.palette-item:active {
    cursor: grabbing;
}
.palette-item:hover {
    border-color: var(--brand-500);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.palette-item-text {
    font-size: 10px;
    font-weight: 500;
    color: #334155;
    line-height: 1.2;
    margin-top: 0.25rem;
}

/* --- FORM CONTROLS & INSPECTOR --- */
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background-color: var(--bg-surface);
    transition: all 0.15s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.wysiwyg-btn {
    padding: 0.25rem;
    border-radius: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}
.wysiwyg-btn:hover {
    background-color: #e2e8f0;
}

/* --- CANVAS & FIELD CARDS --- */
.canvas-section {
    background-color: var(--bg-surface);
    border-radius: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.9);
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.canvas-field {
    padding: 0.625rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: relative;
    cursor: pointer;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
}
.canvas-field:hover {
    border-color: #cbd5e1;
}
.canvas-field.is-selected {
    border: 2px solid var(--brand-500);
    background-color: rgba(239, 246, 255, 0.3);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* --- MODALS & TOASTS --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.hidden {
    display: none;
}

.toast-box {
    background-color: #0f172a;
    color: #ffffff;
    font-size: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}