/* =========================
   Global Reset & Root Layout
========================= */
* {
    box-sizing: border-box;
}

html, body {
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

nav {
    padding: 2rem 2%;
}

/* =========================
   App Shell Layout
========================= */
.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.app-container {
    display: flex;
    flex: 1;          
    overflow: hidden; 
}

/* =========================
   Sidebar (Legacy / Light Theme)
========================= */
aside {
    width: 360px;
    flex-shrink: 0; 
    background: white;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column; 
    padding: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--accent-glow);
    padding:0;
}

aside.collapsed {
    margin-left: -360px;
    opacity: 0;
}

aside::-webkit-scrollbar {
    width: 4px;
}

aside::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 10px;
}

/* =========================
   Main Canvas Area (Legacy)
========================= */
main {
    flex: 1;         
    background-color: #f9fafb;
    padding: 2rem;
    overflow-y: auto; 
}

#canvas-frame {
    margin: 0 auto;
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    min-height: 100%; 
    width: 100%;
    max-width: 1000px;
    min-height: 100%;
}

/* =========================
   Mode Switcher (Legacy)
========================= */
.mode-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 10px;
}

/* switch 容器 */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;   
    height: 20px;  
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 20px;
    transition: 0.4s;
    box-shadow: 0 3px 10px rgba(255,45,149,0.3);
}

.slider::before {
    position: absolute;
    content: "";
    height: 14px;   
    width: 14px;   
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.4s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.switch input:checked + .slider::before {
    transform: translateX(16px); 
}

.switch input:checked + .slider {
    background: linear-gradient(to right, var(--accent-pink), var(--accent-glow));
}

.switch:hover .slider {
    box-shadow: 0 5px 15px rgba(255,45,149,0.4);
}

.switch-label {
    font-weight: bold;
    font-size: 0.75rem;
    color: var(--text-main);
}

/* =========================
   Template List (Sidebar)
========================= */
.template-item {
    margin-bottom: 30px;
    cursor: pointer;
    border-radius: 0.9rem;
    border: 2px solid rgba(0,0,0,0.06);
    background: linear-gradient(
        180deg,
        rgba(255,255,255,0.95),
        rgba(255,255,255,0.85)
    );
    transition: 
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.template-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-pink);
    box-shadow: 0 10px 30px rgba(255,126,179,0.3);
}

.active-template {
    border-color: var(--accent-pink);
    box-shadow:
        0 0 0 2px rgba(255,126,179,0.25),
        0 10px 25px rgba(255,126,179,0.25);
}

.tpl-thumb-container {
    position: relative; 
    aspect-ratio: 10 / 7;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 0.6rem;
    overflow: hidden;
    box-shadow:
        inset 0 1px 2px rgba(255,255,255,0.6),
        inset 0 -2px 4px rgba(0,0,0,0.05);
    cursor: pointer;
}

.tpl-thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease; 
}

.tpl-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0; 
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px); 
    gap: 10px;
}

.tpl-name {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0 1rem;
    text-align: center;
    transform: translateY(10px); 
    transition: transform 0.3s ease;
}

.tpl-thumb-container:hover .tpl-overlay {
    opacity: 1;
}

.tpl-thumb-container:hover .tpl-name {
    transform: translateY(0);
}

.tpl-thumb-container:hover img {
    transform: scale(1.05);
}

/* =========================
   Editor Mode Control
========================= */
[contenteditable="true"]:hover {
    outline: 2px dashed var(--accent-pink);
    background: rgba(255,126,179,0.05);
}

.preview-mode [contenteditable] {
    outline: none !important;
    background: transparent !important;
}

.action-dropdown {
    display: none;
    position: relative;
}

.dropdown-toggle {
    background: linear-gradient(to right, var(--accent-pink), var(--accent-glow));
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,45,149,0.3);
    font-size: 1rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 40px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    padding: 0.5rem;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
}

.dropdown-menu button {
    width: 100%;
    font-size: 0.9rem;
}

.dropdown-toggle.active + .dropdown-menu {
    display: flex;
}

@media screen and (max-width: 960px) {
    .action-buttons {
        display: none;
    }
    .action-dropdown {
        display: flex;
        align-items: center;
    }
}

@media screen and (max-width: 768px) {
    aside {
        position: fixed;
        top: 70px;
        left: -360px; 
        height: 100vh;
        width: 360px;
        background: white;
        z-index: 1000;
        box-shadow: 4px 0 20px rgba(0,0,0,0.2);
        transition: left 0.3s ease;
    }

    aside.open {
        left: 0; 
    }

    main {
        margin-left: 0; 
    }

    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 900;
    }

    #sidebar-overlay.active {
        display: block;
    }
}

@media screen and (min-width: 769px) {
    aside.collapsed {
        margin-left: -360px;
        opacity: 0;
    }
}

#main-sidebar {
    display: flex;
    flex-direction: row; 
    flex: 1;           
    height: 100%;      
    overflow: hidden;   
}

.sidebar-column-left {
    flex: 1;           
    min-width: 0;      
    border-right: 1px solid #f0f0f0;
    overflow-y: auto;   
    padding: 18px;
    height: 100%;       
    background-color: #e0e0e0;
}

.sidebar-column-right {
    width: 70px;      
    overflow-y: auto;   
    padding-top: 18px;
    padding-left: 8px;
    padding-right: 8px;
    height: 100%;      
    background-color: #eee;
}

.sidebar-column-left::-webkit-scrollbar,
.sidebar-column-right::-webkit-scrollbar {
    width: 1px;
}

.sidebar-column-left::-webkit-scrollbar-track 
.sidebar-column-right::-webkit-scrollbar{
    background: transparent; 
}
.sidebar-column-left::-webkit-scrollbar-thumb,
.sidebar-column-right::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 10px;
}
.sidebar-column-left, .sidebar-column-right{
    scrollbar-width: thin; 
    scrollbar-color: #e5e7eb 
}

.sidebar-label {
    font-size: 20px;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.style-item {
    padding: 8px;
    font-size: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.style-item.active-style {
    border-color: #2563eb;
    color: #2563eb;
    background: #f0f7ff;
}

.style-swatch {
    width: 36px;
    height: 90px; 
    border-radius: 32px;
    border: 3px solid #3f3f46;
    display: flex;
    flex-direction: column; 
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 10px;
}

.style-swatch:hover {
    transform: scale(1.1) translateY(-2px);
}

.style-swatch.active-style {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
    width: 38px; 
    border: 4px solid #c82c2c;
}

.swatch-color {
    flex: 1; 
    width: 100%;
}

.style-swatch::after {
    content: attr(data-name);
    position: absolute;
    right: 70px; /* 往左弹出 */
    background: #27272a;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
    border: 1px solid #3f3f46;
}

.style-swatch:hover::after {
    opacity: 1;
}

.premium-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: rgba(150, 150, 150, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit; 
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000000;
}

.inquiry-modal {
    background: #1e1124;
    padding: 30px;
    border-radius: 24px;
    border: 1px solid rgba(255, 45, 149, 0.3);
    width: 380px;
    color: #fce4ec;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.inquiry-modal h3 {
    color: #ff2d95;
    text-shadow: 0 0 10px rgba(255, 45, 149, 0.5);
    margin: 0 0 20px 0;
    text-align: center;
}

.config-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.config-option.active-plan {
    border-color: #ff2d95;
    background: linear-gradient(135deg, rgba(255, 45, 149, 0.1), transparent);
}

.config-option strong {
    display: block;
    margin-bottom: 5px;
    font-size: 15px;
}

.config-option p {
    font-size: 12px;
    color: rgba(252, 228, 236, 0.7);
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.modal-input {
    width: 100%;
    background: #2a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.modal-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-premium {
    background: linear-gradient(135deg, #ff2d95, #00d2ff);
    color: white;
}

.btn-save {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-close-x {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 20px;
}

.ai-radio-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-main);
    transition: all 0.3s;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-radio-label input[type="radio"] {
    accent-color: var(--accent-pink);
    cursor: pointer;
}

.ai-radio-label:has(input:checked) {
    border-color: var(--accent-pink);
    box-shadow: 0 0 10px var(--accent-glow);
    background: rgba(255, 126, 179, 0.1);
}

.ai-prompt-area {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-main);
    padding: 12px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 5px;
    box-sizing: border-box;
}

.ai-prompt-area:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 8px rgba(162, 155, 254, 0.3);
}

.btn-ai-gen {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-pink), var(--accent-blue));
    color: white;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 45, 149, 0.3);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.btn-ai-gen:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 45, 149, 0.5);
}

.ai-disclosure {
    margin-top: 20px;
    font-size: 10px;
    color: var(--text-main);
    opacity: 0.4; 
    margin-bottom: 15px;
    line-height: 1.3;
    text-align: left;
    font-style: italic;
}
.ai-radio-label.is-disabled {
    cursor: not-allowed;
    pointer-events: none;
}

.btn-publish:disabled {
  background-color: #f5f5f5; 
  color: #a0a0a0;           
  border-color: #d9d9d9;   
  cursor: not-allowed; 
  opacity: 0.7;   
}