/* ============================================
   VISUAL BUILDER STYLES
   ============================================ */

/* Builder Container */
.builder {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background: #0a0a0a;
}

/* Top Bar */
.builder-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
    background: #111;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

.builder-topbar-left {
    display: flex;
    align-items: center;
}

.builder-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}

.builder-brand .logo-icon-img {
    width: 28px;
    height: 28px;
}

.builder-brand .logo-text {
    font-weight: 700;
    font-size: 18px;
}

.builder-brand-text {
    font-weight: 600;
    font-size: 15px;
    color: #fff;
}

.builder-topbar-left .builder-topbar-divider {
    width: 1px;
    height: 24px;
    background: #333;
    margin: 0 12px;
}

.builder-topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: none; /* Hide mobile/desktop toggle - showing real responsive view */
}

.preview-toggle {
    display: flex;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 4px;
}

.preview-mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}

.preview-mode-btn:hover {
    color: #999;
}

.preview-mode-btn.active {
    background: #333;
    color: #fff;
}

.builder-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.builder-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
}

.builder-action-btn:hover:not(:disabled) {
    background: #222;
    color: #fff;
}

.builder-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.builder-topbar-divider {
    width: 1px;
    height: 24px;
    background: #333;
    margin: 0 8px;
}

/* Main Area */
.builder-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar - Elements & Tools */
.builder-sidebar-left {
    width: 260px;
    background: #111;
    border-right: 1px solid #222;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.builder-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.builder-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.builder-logo {
    width: 28px;
    height: 28px;
}

.builder-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.builder-hint {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.05));
    border-bottom: 1px solid #222;
    color: #a5b4fc;
    font-size: 12px;
}

.builder-hint svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* Builder Tabs */

.builder-tabs {
    display: none; /* Hidden - only showing Elements panel */
    flex-wrap: wrap;
    padding: 8px;
    gap: 4px;
    border-bottom: 1px solid #222;
}

.builder-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #888;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.builder-tab:hover {
    background: #1a1a1a;
    color: #ccc;
}

.builder-tab.active {
    background: #222;
    color: #fff;
}

.builder-tab svg {
    flex-shrink: 0;
}

/* Builder Panels */
.builder-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.builder-panel.active {
    display: flex;
}

.panel-section {
    margin-bottom: 20px;
}

.panel-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Elements Grid */
.elements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.element-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    cursor: grab;
    transition: all 0.15s;
}

.element-item:hover {
    background: #222;
    border-color: #444;
}

.element-item:active {
    cursor: grabbing;
}

.element-item.dragging {
    opacity: 0.5;
}

.element-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #252525;
    border-radius: 8px;
    color: #888;
}

.element-item:hover .element-icon {
    color: #fff;
}

.element-item span {
    font-size: 11px;
    color: #888;
}

/* Shapes Grid */
.shapes-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.shape-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}

.shape-btn:hover {
    background: #222;
    border-color: #444;
    color: #888;
}

.shape-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

/* Builder Links List */
.builder-links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.builder-link-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.builder-link-item:hover {
    background: #222;
    border-color: #444;
}

.builder-link-item.active {
    border-color: #6366f1;
}

.builder-link-icon {
    font-size: 16px;
}

.builder-link-title {
    flex: 1;
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.builder-link-drag {
    color: #555;
    cursor: grab;
}

/* Builder Avatar Section */
.builder-avatar-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.builder-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: #333;
}

/* Color Grid Compact */
.color-grid.compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.color-field.compact {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.color-field.compact label {
    font-size: 11px;
    color: #888;
}

.color-field.compact input[type="color"] {
    width: 100%;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Button Style Grid */
.button-style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.style-btn-mini {
    padding: 8px 4px;
    font-size: 10px;
    font-weight: 600;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
}

.style-btn-mini:hover {
    background: #222;
    border-color: #444;
    color: #fff;
}

.style-btn-mini.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

/* Animation Controls */
.animation-controls {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-group label {
    width: 50px;
    font-size: 11px;
    color: #888;
}

.slider-group input[type="range"] {
    flex: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    appearance: none;
    cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    background: #6366f1;
    border-radius: 50%;
    cursor: grab;
}

.slider-group .slider-value {
    width: 36px;
    font-size: 11px;
    color: #888;
    text-align: right;
}

/* URL Display */
.url-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
}

.url-display span {
    flex: 1;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: #333;
    color: #fff;
}

/* Builder User Section */
.builder-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-top: auto;
    border-top: 1px solid #222;
}

.builder-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #333;
}

.builder-user-info {
    display: flex;
    flex-direction: column;
}

.builder-user-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
}

.builder-user-plan {
    font-size: 11px;
    color: #6366f1;
}

/* Canvas Area */
.builder-canvas-area {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: #0a0a0a;
    overflow: hidden;
    padding: 0;
}

.builder-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
}

.canvas-phone-frame {
    width: 100%;
    height: 100%;
    background: #111;
    border-radius: 0;
    border: none;
    box-shadow: none;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.canvas-notch {
    display: none;
}

.canvas-content {
    width: 100%;
    min-height: 100%;
    padding: 60px 20px 40px;
    position: relative;
    overflow: visible;
}

/* Canvas Desktop Mode - same as mobile now, full width */
.builder-canvas.desktop .canvas-phone-frame {
    width: 100%;
    height: 100%;
}

.builder-canvas.desktop .canvas-notch {
    display: none;
}

/* Right Sidebar - Properties */
.builder-sidebar-right {
    width: 280px;
    background: #111;
    border-left: 1px solid #222;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.properties-header {
    padding: 16px;
    border-bottom: 1px solid #222;
}

.properties-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.properties-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #555;
    text-align: center;
}

.properties-empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.properties-empty p {
    font-size: 13px;
}

.properties-content {
    padding: 12px;
}

.property-group {
    margin-bottom: 20px;
}

.property-group h4 {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.property-group label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.property-group .input {
    width: 100%;
}

.property-group textarea.input {
    resize: vertical;
    min-height: 60px;
}

/* Shape options */
.shape-options {
    display: flex;
    gap: 8px;
}

.shape-btn {
    flex: 1;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.shape-btn:hover {
    background: #222;
    color: #fff;
}

.shape-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Avatar preview in properties */
.avatar-preview-edit {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-preview-edit img {
    flex-shrink: 0;
}

/* Danger button */
.btn-danger {
    color: #ef4444 !important;
    border-color: #ef4444 !important;
}

.btn-danger:hover {
    background: #ef444422 !important;
}

.property-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.property-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.property-field.full {
    flex: none;
    width: 100%;
}

.property-field label {
    font-size: 10px;
    color: #666;
}

.property-field .unit {
    font-size: 10px;
    color: #555;
}

.property-field input[type="number"] {
    width: 100%;
}

.property-field input[type="color"] {
    width: 100%;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.property-field input[type="range"] {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    appearance: none;
    cursor: pointer;
}

.property-field input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 14px;
    height: 14px;
    background: #6366f1;
    border-radius: 50%;
    cursor: grab;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    margin-bottom: 8px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
}

.effect-controls {
    padding: 10px;
    background: #1a1a1a;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* Layers Section */
.layers-section {
    margin-top: auto;
    border-top: 1px solid #222;
    padding: 12px;
}

.layers-section h3 {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.layers-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #1a1a1a;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.layer-item:hover {
    background: #222;
}

.layer-item.selected {
    border-color: #6366f1;
}

.layer-icon {
    font-size: 12px;
    color: #666;
}

.layer-name {
    flex: 1;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-visibility {
    color: #555;
    cursor: pointer;
}

.layer-visibility:hover {
    color: #888;
}

/* Draggable element on canvas */
.canvas-element {
    position: absolute;
    cursor: move;
    user-select: none;
}

.canvas-element.selected {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.canvas-element.selected::after {
    content: '';
    position: absolute;
    inset: -6px;
    border: 1px dashed rgba(99, 102, 241, 0.5);
}

/* Resize Handles */
.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #6366f1;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 10;
}

.resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.resize-handle.n { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.resize-handle.e { top: 50%; right: -5px; transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.resize-handle.s { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.resize-handle.w { top: 50%; left: -5px; transform: translateY(-50%); cursor: ew-resize; }

/* Drop Zone Indicator */
.canvas-content.drag-over {
    background: rgba(99, 102, 241, 0.1);
    outline: 2px dashed #6366f1;
    outline-offset: -10px;
}

/* Form Compact Styles */
.form-group.compact {
    margin-bottom: 10px;
}

.form-group.compact label {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    display: block;
}

.input-sm {
    padding: 8px 10px;
    font-size: 13px;
    height: 36px;
}

.textarea-sm {
    height: auto;
    resize: vertical;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 1200px) {
    .builder-sidebar-right {
        width: 240px;
    }
    .builder-sidebar-left {
        width: 240px;
    }
}

@media (max-width: 900px) {
    .builder-sidebar-right {
        display: none;
    }
    .builder-canvas-area {
        padding: 20px;
    }
}

@media (max-width: 700px) {
    .builder-sidebar-left {
        width: 200px;
    }
    .builder-tabs {
        flex-direction: column;
    }
    .canvas-phone-frame {
        width: 320px;
        min-height: 600px;
        border-radius: 30px;
    }
}
