/**
 * WidgetMaker 3.0 - Modern Bubble Aesthetic
 * Theme: Vibrant & Playful
 */

:root {
    /* New Modern Color Palette */
    --accent-green: #6CFF39;
    --accent-blue: #5EFFFF;
    --accent-purple: #D173FF;
    --accent-pink: #FF59AD;
    --accent-red: #FE4747;
    --accent-yellow: #FFFF3D;
    --accent-orange: #FFB234;

    /* Dark Theme Base */
    --bg-dark: #1a1a1f;
    --bg-panel: #25252d;
    --bg-node: #2d2d38;
    --bg-input: #2a2a32;

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #b8b8c8;
    --text-muted: #6c6c7c;

    /* Borders */
    --border-thick: 2px;
    --border-thin: 1px;
    --border-color: rgba(255, 255, 255, 0.1);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);

    /* Radii */
    --radius-bubble: 24px;
    --radius-panel: 20px;
    --radius-button: 16px;
    --radius-input: 12px;

    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-medium: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

/* Main Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header - Dark Backdrop */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-dark);
    border-bottom: var(--border-thick) solid var(--border-color);
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-image {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Buttons - Bubble Style */
button {
    padding: 10px 20px;
    border: var(--border-thick) solid transparent;
    border-radius: var(--radius-button);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-medium);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

button:hover::before {
    opacity: 1;
}

button:hover {
    box-shadow: var(--shadow-md);
}

button:active {
    box-shadow: var(--shadow-sm);
}

/* Primary Buttons */
.btn-primary {
    background: var(--accent-blue);
    color: #1a1a1f;
    border-color: var(--accent-blue);
}

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

/* Success Buttons */
.btn-success {
    background: var(--accent-green);
    color: #1a1a1f;
    border-color: var(--accent-green);
}

.btn-success:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

/* Danger Buttons */
.btn-danger {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

.btn-danger:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

/* Secondary Buttons */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: var(--border-thin) solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
}

/* Main Content Layout - Fixed Sizes */
.main-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 68px);
    width: 100vw;
    overflow: hidden;
    background: var(--bg-dark);
    align-items: stretch;
    --w-left: 320px;
    --w-middle: 1fr;
    --w-right: 320px;
    --w-middle-section: 60%;
}

/* Base Column Style */
[class^="column-"] {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex-shrink: 0;
}

/* Column 1: Left Side */
.column-left {
    width: var(--w-left);
    min-width: 200px;
    padding: 12px;
    gap: 12px;
}

/* Column 2: Middle Side - Split into Workspace and Phone Preview */
.column-middle {
    flex: 1;
    min-width: 600px;
    background: #15151a;
    border-left: var(--border-thick) solid var(--bg-dark);
    border-right: var(--border-thick) solid var(--bg-dark);
    position: relative;
    display: flex;
    flex-direction: row;
    padding: 12px;
    gap: 12px;
}

/* Workspace Section (Left side of middle column) */
.workspace-section {
    flex: 0.6;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    height: 100%;
}

/* Phone Preview Section (Right side of middle column) */
.phone-preview-section {
    flex: 0.4;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

/* Column 3: Right Side */
.column-right {
    width: var(--w-right);
    min-width: 300px;
    padding: 12px;
    gap: 12px;
    display: flex;
    flex-direction: column;
}

/* Make settings panel take more space, finish panel smaller */
#panel-properties {
    flex: 1;
    min-height: 200px;
}

#panel-export {
    flex: 0 0 auto;
    padding-bottom: 12px;
}

/* Glass Panel - Bubble Style */
.glass-panel {
    background: var(--bg-panel);
    border: var(--border-thick) solid var(--border-color);
    border-radius: var(--radius-panel);
    overflow: hidden;
    transition: all var(--transition-medium);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    position: relative;
    backdrop-filter: blur(10px);
    flex: 1;
    min-height: 0;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-panel);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    pointer-events: none;
    z-index: 0;
}

.glass-panel>* {
    position: relative;
    z-index: 1;
}

.glass-panel:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md);
}

/* Panel Header with Blue Drag Notch */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: var(--border-thick) solid var(--border-color);
    flex-shrink: 0;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-blue);
    background: linear-gradient(135deg, rgba(94, 255, 255, 0.15), rgba(209, 115, 255, 0.1));
    border-bottom: none;
    flex-shrink: 0;
    cursor: grab;
    user-select: none;
    position: relative;
    margin: 0;
    border: none;
    background: none;
}

.panel-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 32px;
    background: var(--accent-blue);
    border-radius: 0 8px 8px 0;
    box-shadow: 0 0 12px var(--accent-blue);
    opacity: 0.8;
}

.panel-title:active {
    cursor: grabbing;
}

.panel-title h2 {
    font-size: 14px;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Panel Actions - Buttons on the right side of panel header */
.panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Small Button Style */
.btn-sm {
    font-size: 12px !important;
    padding: 6px 12px !important;
}

/* Panel Content */
.panel-content {
    padding: 16px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

/* Preset List */
.preset-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.preset-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: var(--border-thin) solid var(--border-color);
    border-radius: var(--radius-button);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
}

.preset-item:hover {
    background: rgba(94, 255, 255, 0.1);
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-sm);
}

.preset-item span:first-child {
    font-size: 24px;
}

/* Node Palette - Enhanced for Responsive Grid */
.node-palette {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

/* Container Query for Node Palette - Adjusts columns based on container width */
@container node-palette (max-width: 200px) {
    .node-palette {
        grid-template-columns: 1fr;
        grid-auto-rows: minmax(80px, auto);
    }
}

@container node-palette (min-width: 201px) and (max-width: 300px) {
    .node-palette {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(80px, auto);
    }
}

@container node-palette (min-width: 301px) and (max-width: 400px) {
    .node-palette {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: minmax(80px, auto);
    }
}

@container node-palette (min-width: 401px) and (max-width: 500px) {
    .node-palette {
        grid-template-columns: repeat(4, 1fr);
        grid-auto-rows: minmax(80px, auto);
    }
}

@container node-palette (min-width: 501px) {
    .node-palette {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        grid-auto-rows: minmax(80px, auto);
    }
}

/* Fallback for browsers without container query support */
@supports not (container-type: inline-size) {
    .node-palette {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        grid-auto-rows: minmax(80px, auto);
    }
}

/* Ensure buttons don't overflow their grid cells */
.node-btn {
    width: 100%;
    height: 100%;
    min-height: 80px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
    word-wrap: break-word;
    hyphens: auto;
}

/* Prevent text overflow in node labels */
.node-label {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-secondary);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.node-btn {
    aspect-ratio: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-node);
    border: var(--border-thin) solid var(--border-color);
    border-radius: var(--radius-button);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    /* Ensure consistent sizing */
    min-height: 80px;
    box-sizing: border-box;
    overflow: hidden;
}

.node-btn:hover {
    background: rgba(94, 255, 255, 0.1);
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.node-icon {
    font-size: 28px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.node-label {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-secondary);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    flex-shrink: 0;
}

/* Node Editor Canvas */
.node-editor-container {
    background: #15151a;
    position: relative;
    padding: 0 !important;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    border-radius: var(--radius-panel);
    border: var(--border-thick) solid var(--border-color);
}

#node-canvas {
    display: block;
}

/* Visual Editor Container */
.visual-editor-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Phone Preview Container */
.phone-aspect {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #15151a;
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
    margin: 8px;
    border-radius: 32px;
    border: 8px solid var(--bg-panel);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    position: relative;
    overflow: hidden;
    /* Wider to fit the outer main box - increased from 75% to 90% */
    width: 90%;
    min-width: 280px;
    /* Ensure proper centering */
    margin-left: auto;
    margin-right: auto;
}

#visual-canvas-main {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    /* Smooth zoom/pan transitions applied via JS _applyPreviewTransform() */
    will-change: transform;
    transform-origin: center center;
}

/* Properties Panel */
.properties-panel {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.property-group {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-input);
    padding: 12px;
    border: var(--border-thin) solid var(--border-color);
}

.property-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    letter-spacing: 0.5px;
}

/* Inputs - Bubble Style */
input[type="text"],
input[type="number"],
select {
    width: 100%;
    background: var(--bg-input);
    border: var(--border-thin) solid var(--border-color);
    border-radius: var(--radius-input);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all var(--transition-fast);
}

input:focus,
select:focus {
    background: rgba(94, 255, 255, 0.1);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(94, 255, 255, 0.2);
}

/* Range Sliders */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    margin-top: -7px;
    box-shadow: 0 2px 8px rgba(94, 255, 255, 0.5);
    border: 2px solid white;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--bg-input);
    border-radius: 2px;
    border: var(--border-thin) solid var(--border-color);
}

/* Export Section */
.export-summary {
    margin-top: auto;
    padding-top: 12px;
    border-top: var(--border-thin) solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-input);
    padding: 12px;
    margin-bottom: 8px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 4px;
    padding: 4px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.summary-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.summary-row span:first-child {
    color: var(--text-secondary);
}

.summary-row span:last-child {
    color: var(--accent-blue);
    font-weight: 700;
}

/* State Toggle Buttons */
.state-toggle {
    background: rgba(0, 0, 0, 0.6);
    padding: 4px;
    border-radius: var(--radius-input);
    display: flex;
    gap: 4px;
}

.state-toggle button {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.state-toggle button.active {
    background: var(--accent-green);
    color: #1a1a1f;
    box-shadow: 0 2px 8px rgba(108, 255, 57, 0.3);
}

/* Visual Controls */
.visual-controls {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px;
    border-radius: var(--radius-input);
    border: var(--border-thin) solid var(--border-color);
}

.visual-controls button {
    padding: 6px 10px;
    font-size: 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: var(--border-thin) solid var(--border-color);
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.visual-controls button:hover {
    background: rgba(94, 255, 255, 0.1);
    border-color: var(--accent-blue);
}

.visual-controls span {
    font-family: monospace;
    font-size: 11px;
    color: var(--accent-blue);
    margin-left: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border: 1px solid rgba(94, 255, 255, 0.2);
}

/* Visual State Toggle */
.visual-state-toggle {
    display: flex;
    gap: 4px;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: var(--radius-input);
    border: var(--border-thin) solid var(--border-color);
}

.visual-state-toggle button {
    flex: 1;
    padding: 8px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: var(--border-thin) solid var(--border-color);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 700;
}

.visual-state-toggle button.active {
    background: var(--accent-green);
    color: #1a1a1f;
    border-color: var(--accent-green);
    box-shadow: 0 2px 8px rgba(108, 255, 57, 0.3);
}

.visual-state-toggle button:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

/* Visual Tools */
.visual-tools {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: var(--radius-input);
    border: var(--border-thin) solid var(--border-color);
}

.visual-tools button {
    flex: 1;
    min-width: 80px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: var(--border-thin) solid var(--border-color);
    color: white;
    font-size: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.visual-tools button:hover {
    background: rgba(94, 255, 255, 0.1);
    border-color: var(--accent-blue);
}

/* Empty State */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.3s ease;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: var(--radius-panel);
    border: var(--border-thin) dashed rgba(255, 255, 255, 0.1);
}

.empty-icon {
    font-size: 48px;
    filter: drop-shadow(0 0 8px rgba(94, 255, 255, 0.5));
}

.empty-state h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.empty-state p {
    font-size: 11px;
    color: var(--text-secondary);
    margin: 0;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-node);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Notifications */
.notification-widget {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-button);
    font-weight: 600;
    z-index: 10001;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    border: var(--border-thick) solid;
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
}

.notification-widget.success {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.notification-widget.error {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.notification-widget.info {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Toast Notifications */
#notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10001;
    pointer-events: none;
}

.notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-button);
    font-weight: 500;
    font-size: 14px;
    pointer-events: auto;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-info {
    background: var(--bg-panel);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.toast-success {
    background: rgba(75, 214, 239, 0.1);
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.toast-error {
    background: rgba(255, 85, 85, 0.1);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.toast-warning {
    background: rgba(255, 196, 0, 0.1);
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

.notification .close {
    cursor: pointer;
    margin-left: 12px;
    font-weight: bold;
    opacity: 0.7;
}

.notification .close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Dialogs */
.alert-dialog,
.confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-panel);
    border: var(--border-thick) solid var(--border-color);
    border-radius: var(--radius-panel);
    padding: 24px;
    min-width: 300px;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    z-index: 10002;
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.alert-dialog h3,
.confirm-dialog h3 {
    color: var(--accent-blue);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}

.alert-dialog p,
.confirm-dialog p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
    text-align: center;
}

.alert-dialog .actions,
.confirm-dialog .actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.alert-dialog button,
.confirm-dialog button {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.alert-dialog .btn-primary,
.confirm-dialog .btn-primary {
    background: var(--accent-blue);
    color: #1a1a1f;
    border: none;
}

.alert-dialog .btn-primary:hover,
.confirm-dialog .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(94, 255, 255, 0.4);
}

.confirm-dialog .btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: var(--border-thin) solid var(--border-color);
}

.confirm-dialog .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-blue);
}

@keyframes popIn {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }

    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Overlay for dialogs */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10001;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Drag States */
.ghost {
    pointer-events: none;
    border: 2px dashed var(--accent-blue) !important;
    background: rgba(94, 255, 255, 0.1) !important;
    backdrop-filter: blur(5px);
}

.widget-panel.dragging,
section[class^="panel-"].dragging {
    opacity: 0.7;
    transform: scale(0.98);
    box-shadow: 0 0 20px var(--accent-blue);
}

.widget-panel.drop-target,
section[class^="panel-"].drop-target {
    outline: 2px dashed var(--accent-blue);
    outline-offset: -4px;
    background: rgba(94, 255, 255, 0.05);
}

/* Loading Indicator */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Adjustments */
@media (max-width: 1600px) {
    .main-layout {
        --w-left: 22%;
        --w-right: 22%;
    }
}

@media (max-width: 1400px) {
    .main-layout {
        --w-left: 20%;
        --w-right: 20%;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a1f 0%, #2a2a35 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    color: #cdd6f4;
}

.modal-close {
    background: none;
    border: none;
    color: #cdd6f4;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 0;
}

@media (max-width: 1200px) {
    .main-layout {
        --w-left: 18%;
        --w-right: 18%;
    }
}
