/**
 * Panel Layout Styles
 * The three-panel editor layout (Design | Canvas | Add) shared by the new menus.
 * Always loaded, the Add menu is a panel; the Design menu is the sidebar over the canvas (designMenu.css).
 */

/* ============================================
   CSS Variables for New Design Menu
   ============================================ */
:root {
    --ndm-primary-color: #00a3cc;
    --ndm-primary-hover: #0090b8;
    --ndm-secondary-color: #1a2530;
    --ndm-background: rgba(20, 30, 40, 0.95);
    --ndm-background-light: rgba(30, 45, 60, 0.95);
    --ndm-text-color: #ffffff;
    --ndm-text-muted: rgba(255, 255, 255, 0.7);
    --ndm-border-color: rgba(255, 255, 255, 0.1);
    --ndm-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --ndm-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --ndm-border-radius: 8px;
    --ndm-spacing-xs: 4px;
    --ndm-spacing-sm: 8px;
    --ndm-spacing-md: 16px;
    --ndm-spacing-lg: 24px;
    --ndm-initial-width: 500px;
    --ndm-toggle-width: 44px;
}

/* ============================================
   NEW EDITOR LAYOUT - 50/50 Split
   Only applies when .editor-layout--new class is present
   ============================================ */
.editor-layout--new {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: calc(100vh - 50px); /* Subtract nav height */
    position: relative;
    top: 0;
    left: 0;
}

/* Panel containers */
.editor-layout--new .editor-layout__panel {
    height: 100%;
    transition: flex 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Design menu panel (left) - collapsed by default */
.editor-layout--new .editor-layout__panel--design {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    display: flex;
    flex-direction: row;
}

.editor-layout--new .editor-layout__panel--design.panel--open {
    flex: 0 0 50%;
    width: 50%;
}

/* Canvas panel (center) */
.editor-layout--new .editor-layout__panel--canvas {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Add menu panel (right) - collapsed by default */
.editor-layout--new .editor-layout__panel--add {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
    display: flex;
    flex-direction: row;
}

.editor-layout--new .editor-layout__panel--add.panel--open {
    flex: 0 0 35%;
    width: 35%;
}

@media screen and (max-width: 640px) {
    .editor-layout--new .editor-layout__panel--add.panel--open {
        flex: 0 0 50%;
        width: 50%;
    }
}

/* Panel Sidebar Styling */
.editor-layout--new .panel-sidebar {
    display: flex;
    flex-direction: row-reverse; /* Left panel: toggle on right (inside, closest to canvas) */
    width: 44px; /* Only toggle width when collapsed */
    height: 100%;
    background: transparent; /* No background when collapsed */
    color: #ffffff;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), background 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When panel is open, show full sidebar with background */
.editor-layout--new .panel--open .panel-sidebar {
    width: 100%;
    background: linear-gradient(135deg, rgba(15, 25, 35, 0.97) 0%, rgba(20, 35, 50, 0.95) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.editor-layout--new .panel-sidebar--right {
    flex-direction: row !important; /* Right panel: toggle on left (inside, closest to canvas) */
}

.editor-layout--new .panel-sidebar__toggleWrap {
    position: relative;
    width: 44px;
    min-width: 44px;
    height: 100%;
}

/* Toggle Button */
.editor-layout--new .panel-sidebar__toggle {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    cursor: pointer;
    width: 44px;
    min-width: 44px;
    height: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: linear-gradient(180deg, #00b8d4 0%, #0091a8 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 2px 0 8px rgba(0, 0, 0, 0.2); /* Shadow on left for left panel toggle */
}

.editor-layout--new .panel-sidebar--right .panel-sidebar__toggle {
    box-shadow: inset -2px 0 8px rgba(0, 0, 0, 0.2); /* Shadow on right for right panel toggle */
}

.editor-layout--new .panel-sidebar__toggle:hover {
    background: linear-gradient(180deg, #00d4f5 0%, #00a3cc 100%);
}

.editor-layout--new .panel-sidebar__toggle-text {
    display: block;
    transform: rotate(90deg); /* Rotate text for left panel (toggle on right side) */
    white-space: nowrap;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.editor-layout--new .panel-sidebar--right .panel-sidebar__toggle-text {
    transform: rotate(-90deg); /* Rotate text for right panel (toggle on left side) */
}

/* ============================================
   Panel Resize Handle & Maximize Button
   ============================================ */

/* Resize handle on toggle button - appears when panel is open */
.editor-layout--new .panel-sidebar__toggle {
    position: relative;
}

.editor-layout--new .panel--open .panel-sidebar__toggle {
    cursor: ew-resize;
}

/* Visual indicator for resize (subtle line on the draggable edge) */
.editor-layout--new .panel--open .panel-sidebar__toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Left panel: resize handle on right edge of toggle */
.editor-layout--new .editor-layout__panel--design.panel--open .panel-sidebar__toggle::before {
    right: 6px;
}

/* Right panel: resize handle on left edge of toggle */
.editor-layout--new .editor-layout__panel--add.panel--open .panel-sidebar__toggle::before {
    left: 6px;
}

.editor-layout--new .panel--open .panel-sidebar__toggle:hover::before {
    opacity: 1;
}

/* Maximize button in toggle */
.editor-layout--new .panel-sidebar__maximize-btn {
    position: absolute;
    top: 10px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    display: none; /* Hidden by default, shown when panel is open */
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 10;
    transition: all 0.2s ease;
}

.editor-layout--new .panel-sidebar__toggleWrap .panel-sidebar__maximize-btn {
    pointer-events: auto;
}

.editor-layout--new .panel--open .panel-sidebar__maximize-btn {
    display: flex;
}

.editor-layout--new .panel-sidebar__maximize-btn:hover {
    background: rgba(0, 163, 204, 0.5);
    border-color: rgba(0, 163, 204, 0.8);
    color: #ffffff;
    transform: scale(1.1);
}

/* Position maximize button based on panel side */
.editor-layout--new .editor-layout__panel--design .panel-sidebar__maximize-btn {
    right: 8px;
}

.editor-layout--new .editor-layout__panel--add .panel-sidebar__maximize-btn {
    left: 8px;
}

/* Maximized panel state */
.editor-layout--new .editor-layout__panel--maximized {
    flex: 1 1 100% !important;
    width: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100;
}

/* Hide canvas when a panel is maximized */
.editor-layout--new.has-maximized-panel .editor-layout__panel--canvas {
    display: none;
}

/* Hide the other panel when one is maximized */
.editor-layout--new.has-maximized-panel .editor-layout__panel:not(.editor-layout__panel--maximized) {
    display: none;
}

.editor-layout--new .editor-layout__panel--maximized .panel-sidebar {
    width: 100%;
}

/* When maximized, thumbnails can wrap */
.editor-layout--new .editor-layout__panel--maximized .ndm-thumbnails {
    flex-wrap: wrap;
}

.editor-layout--new .editor-layout__panel--maximized .ndm-options-row__options {
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: auto;
}

/* Resize active state (while dragging) */
.editor-layout--new.panel-resizing {
    cursor: ew-resize !important;
    user-select: none;
}

.editor-layout--new.panel-resizing * {
    cursor: ew-resize !important;
    user-select: none !important;
}

/* Disable all transitions during resizing for immediate feedback */
.editor-layout--new.panel-resizing .editor-layout__panel,
.editor-layout--new.panel-resizing .panel-sidebar,
.editor-layout--new.panel-resizing .panel-sidebar__content,
.editor-layout--new.panel-resizing .panel-sidebar__toggle {
    transition: none !important;
}

/* Sidebar Content */
.editor-layout--new .panel-sidebar__content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    opacity: 0;
    overflow: hidden;
    border-left: 1px solid rgba(0, 163, 204, 0.2); /* Border on inside edge */
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.editor-layout--new .panel-sidebar--right .panel-sidebar__content {
    border-left: none;
    border-right: 1px solid rgba(0, 163, 204, 0.2); /* Border on inside edge */
}

.editor-layout--new .panel--open .panel-sidebar__content {
    opacity: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar styling for panel content */
.editor-layout--new .panel-sidebar__content::-webkit-scrollbar {
    width: 6px;
}

.editor-layout--new .panel-sidebar__content::-webkit-scrollbar-track {
    background: transparent;
}

.editor-layout--new .panel-sidebar__content::-webkit-scrollbar-thumb {
    background: var(--ndm-primary-color);
    border-radius: 3px;
}

/* ds-tabs within panels */
.panel-sidebar .ds-tabs {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    width: 100%;
}

.panel-sidebar .ds-tabs__navigation {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: rgb(10, 35, 45);
    border-bottom: 1px solid rgb(0, 130, 165);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    align-items: center;
}

.panel-sidebar .ds-tabs__navigation-item {
    position: relative;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: rgb(180, 180, 180);
    cursor: pointer;
    border: none;
    background: rgb(25, 40, 55);
    border-radius: 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.panel-sidebar .ds-tabs__navigation-item:hover {
    color: rgb(255, 255, 255);
    background: rgb(0, 100, 130);
    transform: translateY(-1px);
}

.panel-sidebar .ds-tabs__content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px;
    scrollbar-width: thin;
    scrollbar-color: #00a3cc transparent;
    height: auto;
}

.panel-sidebar .ds-tabs__content::-webkit-scrollbar {
    width: 6px;
}

.panel-sidebar .ds-tabs__content::-webkit-scrollbar-track {
    background: transparent;
}

.panel-sidebar .ds-tabs__content::-webkit-scrollbar-thumb {
    background: #00a3cc;
    border-radius: 3px;
}

/* Divider within panels */
.panel-sidebar .divider {
    height: 1px;
    background: rgba(0, 163, 204, 0.25);
    margin: 0;
}

/* Canvas panel needs position relative for action-bar positioning */
.editor-layout__panel--canvas {
    position: relative;
}

/* Action bar positioning is inherited from main stylesheet */
/* The action-bar already has position: absolute, centered with transform */
/* We just need pointer-events for overlay functionality */
.editor-layout__panel--canvas .action-bar {
    pointer-events: none;
}

.editor-layout__panel--canvas .action-bar * {
    pointer-events: auto;
}

/* Canvas styling within the panel */
.editor-layout__panel--canvas canvas {
    display: block;
}

/* ============================================
   Login / Sign Up / Share modals
   Dark glass look of the panels instead of the old teal modal
   ============================================ */
.UIModal.UIModal_Login {
    background: linear-gradient(135deg, rgba(15, 25, 35, 0.97) 0%, rgba(20, 35, 50, 0.95) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 163, 204, 0.25);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 120, 180, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: var(--ndm-text-color);
    overflow: hidden;
    animation: modalSlideIn 0.25s ease-out;
}

.UIModal.UIModal_Login .UIButton_Close {
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--ndm-text-muted);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ndm-border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 2;
}

.UIModal.UIModal_Login .UIButton_Close:hover {
    color: #ffffff;
    background: rgba(0, 163, 204, 0.35);
    border-color: rgba(0, 163, 204, 0.8);
}

.UIModal_Login .login-modal__header {
    padding: 2rem 1.5rem 1.25rem;
    background: linear-gradient(180deg, rgba(0, 150, 200, 0.15) 0%, transparent 100%);
    border-bottom: 1px solid var(--ndm-border-color);
    margin-bottom: 1.25rem;
}

.UIModal_Login .login-modal__icon {
    width: 56px;
    height: 56px;
    color: #ffffff;
    background: linear-gradient(180deg, #00b8d4 0%, #0091a8 100%);
    border: none;
    box-shadow: 0 6px 20px rgba(0, 163, 204, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.UIModal_Login .login-modal__title {
    font-size: 1.25rem;
    color: #ffffff;
}

.UIModal_Login .login-modal__subtitle {
    color: var(--ndm-text-muted);
}

.UIModal_Login .login-modal__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--ndm-text-muted);
}

.UIModal_Login .login-modal__input {
    padding: 11px 14px 11px 42px;
    font-size: 14px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ndm-border-color);
    border-radius: var(--ndm-border-radius);
    box-sizing: border-box;
    transition: var(--ndm-transition);
}

.UIModal_Login .login-modal__input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.UIModal_Login .login-modal__input:focus {
    border-color: var(--ndm-primary-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(0, 163, 204, 0.2);
}

/* Keep autofilled fields dark */
.UIModal_Login .login-modal__input:-webkit-autofill {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0 1000px #17283a inset;
    caret-color: #ffffff;
}

.UIModal_Login .login-modal__input-icon {
    left: 14px;
    color: rgba(255, 255, 255, 0.4);
}

.UIModal_Login .login-modal__input-wrapper:focus-within .login-modal__input-icon {
    color: var(--ndm-primary-color);
}

.UIModal_Login .login-modal__feedback:not(:empty) {
    background: rgba(0, 163, 204, 0.1);
    border: 1px solid rgba(0, 163, 204, 0.3);
    box-shadow: none;
}

.UIModal_Login .login-modal__submit {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    background: linear-gradient(180deg, #00b8d4 0%, #0091a8 100%);
    border-radius: var(--ndm-border-radius);
    box-shadow: 0 4px 14px rgba(0, 163, 204, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.UIModal_Login .login-modal__submit:hover:not(:disabled) {
    background: linear-gradient(180deg, #00d4f5 0%, #00a3cc 100%);
    box-shadow: 0 6px 20px rgba(0, 163, 204, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.UIModal_Login .login-modal__footer {
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--ndm-border-color);
}

.UIModal_Login .login-modal__forgot {
    color: var(--ndm-text-muted);
}

.UIModal_Login .login-modal__forgot:hover,
.UIModal_Login .login-modal__signup strong {
    color: #00d4ff;
}

.UIModal_Login .login-modal__divider {
    background: var(--ndm-border-color);
}

/* Share modal: links, copy buttons and image cards */
.UIModal_Share .login-modal__content--scrollable {
    padding-bottom: 1.5rem;
}

.UIModal_Share .login-modal__input-wrapper--link {
    padding: 8px 8px 8px 42px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--ndm-border-color);
    border-radius: var(--ndm-border-radius);
}

.UIModal_Share .login-modal__input-wrapper--link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 163, 204, 0.5);
}

.UIModal_Share .login-modal__link {
    font-size: 13px;
    color: #00d4ff;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
}

.UIModal_Share .login-modal__link:hover {
    color: #ffffff;
}

.UIModal_Share .login-modal__section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.5rem 0 0;
    font-size: 11px;
    color: #ffffff;
    letter-spacing: 1.5px;
}

.UIModal_Share .login-modal__section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, #00d4ff 0%, #00a3cc 100%);
    border-radius: 2px;
}

.UIModal_Share .login-modal__hint {
    margin: -0.75rem 0 0;
    font-size: 12px;
    font-style: normal;
    color: rgba(255, 255, 255, 0.45);
}

.UIModal_Share .share-copy-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ndm-border-color);
    border-radius: 6px;
    color: var(--ndm-text-muted);
}

.UIModal_Share .share-copy-btn:hover {
    background: rgba(0, 163, 204, 0.35);
    border-color: rgba(0, 163, 204, 0.8);
    color: #ffffff;
}

.UIModal_Share .share-copy-btn--image {
    background: rgba(10, 18, 26, 0.75);
    border-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.UIModal_Share .share-images-grid {
    margin-top: 0;
    gap: 10px;
}

.UIModal_Share .share-image-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--ndm-border-color);
    border-radius: var(--ndm-border-radius);
}

.UIModal_Share .share-image-item:hover {
    border-color: var(--ndm-primary-color);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 163, 204, 0.3);
}

.UIModal_Share .share-image-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--ndm-text-muted);
    background: rgba(0, 0, 0, 0.35);
    border-top: 1px solid var(--ndm-border-color);
}

.UIModal_Share .login-modal__content--scrollable::-webkit-scrollbar-thumb {
    background: rgba(0, 163, 204, 0.4);
}

/* Glow states (glowInGreen after a successful login, glowInRed, glow) on top of the dark glass */
.UIModal.UIModal_Login.frostedGlass--green {
    background: linear-gradient(135deg, rgba(20, 60, 35, 0.96) 0%, rgba(15, 45, 30, 0.95) 100%);
    border: 1px solid rgb(100, 255, 100);
    box-shadow: 0 0 0 1px rgba(100, 255, 100, 0.4), 0 0 40px rgba(100, 255, 100, 0.55), 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(100, 255, 100, 0.15);
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.UIModal.UIModal_Login.frostedGlass--red {
    background: linear-gradient(135deg, rgba(60, 20, 20, 0.96) 0%, rgba(45, 15, 15, 0.95) 100%);
    border: 1px solid rgb(255, 60, 60);
    box-shadow: 0 0 0 1px rgba(255, 60, 60, 0.4), 0 0 40px rgba(255, 60, 60, 0.5), 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(255, 60, 60, 0.15);
}

.UIModal.UIModal_Login.frostedGlass--primaryColor {
    border: 1px solid rgb(0, 163, 204);
    box-shadow: 0 0 0 1px rgba(0, 163, 204, 0.4), 0 0 40px rgba(0, 163, 204, 0.55), 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(0, 163, 204, 0.15);
}

.UIModal_Login.frostedGlass--green .login-modal__header {
    background: linear-gradient(180deg, rgba(100, 255, 100, 0.18) 0%, transparent 100%);
}

.UIModal_Login.frostedGlass--green .login-modal__icon {
    background: linear-gradient(180deg, #5cf06a 0%, #22b33a 100%);
    box-shadow: 0 0 24px rgba(100, 255, 100, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.UIModal_Login.frostedGlass--green .login-modal__feedback:not(:empty) {
    color: #ffffff;
    background: rgba(100, 255, 100, 0.15);
    border-color: rgba(100, 255, 100, 0.6);
}

.UIModal_Login.frostedGlass--red .login-modal__feedback:not(:empty) {
    background: rgba(255, 60, 60, 0.15);
    border-color: rgba(255, 60, 60, 0.6);
}
