:root {
    --pb-bg: #0a0a0f;
    --pb-sidebar: #111118;
    --pb-card: #16161d;
    --pb-border: #27272a;
    --pb-primary: #6366f1;
    --pb-primary-glow: rgba(99, 102, 241, 0.15);
    --pb-text: #e4e4e7;
    --pb-muted: #71717a;
    --pb-success: #10b981;
    --pb-danger: #ef4444;
}

body.page-builder-active {
    background: var(--pb-bg) !important;
    margin: 0;
    overflow: hidden;
    height: 100vh;
}

body.page-builder-active .footer {
    display: none !important;
}

.pb-layout {
    display: flex;
    position: absolute;
    top: 96px;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Poppins', sans-serif;
    overflow: hidden;
    z-index: 10;
    transition: all 0.3s ease;
}


/* ===== LEFT SIDEBAR ===== */
.pb-sidebar {
    width: 300px;
    min-width: 300px;
    height: 100%;
    min-height: 0;
    background: var(--pb-sidebar);
    border-right: 1px solid var(--pb-border);
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

#sidebar-categories-view,
#sidebar-components-view,
#sidebar-settings-view {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3f3f46 transparent;
}

#sidebar-categories-view::-webkit-scrollbar,
#sidebar-components-view::-webkit-scrollbar,
#sidebar-settings-view::-webkit-scrollbar {
    width: 4px;
}

#sidebar-categories-view::-webkit-scrollbar-thumb,
#sidebar-components-view::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
}

#sidebar-categories-view {
    padding: 16px 0;
}

.pb-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--pb-muted);
    padding: 0 16px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pb-cat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 16px 16px;
}

.pb-cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px;
    color: var(--pb-muted);
    background: #181820;
    border: 1px solid var(--pb-border);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.pb-cat:hover,
.pb-cat.active {
    background: var(--pb-card);
    color: white;
    border-color: var(--pb-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pb-cat i {
    font-size: 20px;
    color: var(--pb-text);
    opacity: 0.9;
    margin-bottom: 2px;
}

.pb-cat:hover i,
.pb-cat.active i {
    color: var(--pb-primary);
    opacity: 1;
}

/* ===== COMPONENTS VIEW HEADER ===== */
.pb-components-header {
    padding: 16px;
    border-bottom: 1px solid var(--pb-border);
    background: var(--pb-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.pb-back-btn {
    background: transparent;
    border: none;
    color: var(--pb-muted);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 0;
    margin-bottom: 12px;
    transition: color 0.2s;
}

.pb-back-btn:hover {
    color: white;
}

.pb-center-title {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.pb-center-count {
    font-size: 11px;
    color: var(--pb-muted);
    font-weight: 500;
}

#center-content {
    padding: 16px;
}

.pb-center-count {
    font-size: 12px;
    color: var(--pb-muted);
    background: var(--pb-card);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--pb-border);
}

.pb-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.pb-breakpoint-switcher {
    display: flex;
    background: #18181b;
    border: 1px solid var(--pb-border);
    border-radius: 6px;
    padding: 2px;
    margin-top: 10px;
}

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

.pb-bp-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.pb-bp-btn.active {
    background: var(--pb-primary);
    color: white;
}


/* ===== SETTINGS VIEW ===== */
.pb-settings-content {
    padding: 16px;
}

.pb-setting-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pb-setting-group label {
    font-size: 11px;
    font-weight: 700;
    color: #a1a1aa;
    /* Lightened from muted for better visibility */
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
}

.pb-setting-group input[type="text"],
.pb-setting-group input[type="color"] {
    width: 100%;
    padding: 10px 12px;
    background: #0f1015;
    /* Darker background for more pop */
    border: 1px solid var(--pb-border);
    border-radius: 6px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    transition: all 0.2s;
}

.pb-setting-group input[type="text"]:focus,
.pb-setting-group input[type="color"]:focus {
    outline: none;
    border-color: var(--pb-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.pb-setting-group input[type="color"] {
    padding: 2px 4px;
    height: 40px;
    cursor: pointer;
}

.pb-setting-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.pb-setting-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pb-setting-grid-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pb-setting-grid-input input {
    text-align: center;
    padding: 8px 4px !important;
}

.pb-setting-grid-input span {
    font-size: 10px;
    color: var(--pb-muted);
}

.pb-setting-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.pb-setting-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.pb-setting-align-group {
    display: flex;
    background: #181820;
    border: 1px solid var(--pb-border);
    border-radius: 6px;
    overflow: hidden;
}

.pb-setting-align-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--pb-muted);
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pb-setting-align-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.pb-setting-align-btn.active {
    background: var(--pb-primary);
    color: white;
}

.pb-comp-card {
    background: var(--pb-card);
    border: 1px solid var(--pb-border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;
}

.pb-comp-card:hover {
    border-color: var(--pb-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.1);
}

.pb-comp-preview {
    position: relative;
    height: 160px;
    overflow: hidden;
    background: #0b1220;
}

.pb-comp-preview iframe {
    width: 200%;
    height: 200%;
    border: none;
    transform: scale(0.5);
    transform-origin: top left;
    pointer-events: none;
}

.pb-comp-info {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pb-comp-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--pb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.pb-comp-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    margin-left: 8px;
}

.pb-premium-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f59e0b;
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.pb-comp-price {
    font-size: 11px;
    font-weight: 700;
    color: #f59e0b;
    margin-left: auto;
}


.pb-add-btn {
    background: var(--pb-primary);
    color: white;
    border: none;
    width: 100%;
    padding: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.pb-add-btn:hover {
    background: #4f46e5;
}

.pb-add-btn.added {
    background: var(--pb-success);
    pointer-events: none;
}

.pb-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--pb-muted);
}

.pb-empty i {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.3;
}

.pb-loading {
    text-align: center;
    padding: 40px;
    color: var(--pb-muted);
}

/* ===== RIGHT PANEL ===== */
.pb-right {
    flex: 1;
    min-width: 380px;
    height: 100%;
    min-height: 0;
    background: var(--pb-sidebar);
    border-left: 1px solid var(--pb-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pb-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--pb-border);
    background: #0d0d14;
    min-height: 46px;
}

.pb-toolbar-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pb-toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--pb-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pb-section-count {
    background: var(--pb-primary);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
}

.pb-toolbar-btn {
    background: #1e1e26;
    border: 1px solid var(--pb-border);
    color: var(--pb-text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.pb-toolbar-btn:hover {
    background: #27272f;
    border-color: var(--pb-primary);
    color: white;
}

.pb-toolbar-btn.primary {
    background: var(--pb-success);
    border-color: var(--pb-success);
    color: white;
}

.pb-preview-frame {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.pb-preview-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Section list overlay */
.pb-sections-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: none;
    min-height: 0;
}

.pb-section-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--pb-card);
    border: 1px solid var(--pb-border);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.pb-section-item:hover {
    border-color: var(--pb-primary);
}

.pb-section-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--pb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-section-actions {
    display: flex;
    gap: 4px;
}

.pb-section-actions button {
    background: transparent;
    border: 1px solid var(--pb-border);
    color: var(--pb-muted);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
}

.pb-section-actions button:hover {
    background: var(--pb-primary-glow);
    color: white;
    border-color: var(--pb-primary);
}

.pb-section-actions button.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--pb-danger);
    border-color: var(--pb-danger);
}

.pb-view-toggle {
    display: flex;
    background: #1e1e26;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--pb-border);
}

.pb-view-btn {
    background: none;
    border: none;
    color: var(--pb-muted);
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.pb-view-btn.active {
    background: var(--pb-primary);
    color: white;
}

.pb-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    padding: 40px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    margin: 20px;
    border-radius: 12px;
}

.pb-canvas-add-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--pb-primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pb-canvas-add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
    background: #7578f5;
}

.pb-placeholder-text {
    color: var(--pb-muted);
    font-size: 14px;
    font-weight: 500;
}

.pb-placeholder p {
    font-size: 14px;
    max-width: 260px;
    line-height: 1.6;
}

.pb-device-toggle {
    display: flex;
    background: #1e1e26;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--pb-border);
}

.pb-device-btn {
    background: none;
    border: none;
    color: var(--pb-muted);
    padding: 5px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pb-device-btn:hover {
    color: white;
}

.pb-device-btn.active {
    background: var(--pb-primary);
    color: white;
}

.pb-preview-frame iframe.tablet-view {
    max-width: 768px;
    margin: 0 auto;
    display: block;
}

.pb-preview-frame iframe.mobile-view {
    max-width: 375px;
    margin: 0 auto;
    display: block;
}

/* ===== CONTEXT MENU ===== */
.pb-context-menu {
    position: fixed;
    z-index: 100000;
    width: 200px;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 6px;
    display: none;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #e4e4e7;
}

.pb-context-menu.show {
    display: flex;
}

.pb-cm-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.15s;
}

.pb-cm-item i {
    font-size: 14px;
    opacity: 0.8;
}

.pb-cm-item:hover {
    background: #27272a;
    color: white;
}

.pb-cm-item.pb-cm-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.pb-cm-item.pb-cm-danger:hover i {
    color: #ef4444;
}

.pb-cm-divider {
    height: 1px;
    background: #27272a;
    margin: 6px 0;
}