/* Designer Interface - Premium Tool Experience */

/* Reset for designer */
.designer-body {
    margin: 0;
    padding: 0;
    padding-top: 64px; /* Account for fixed nav */
    overflow-x: hidden; /* Fix: Allow vertical scroll */
    background: #f8f9fa;
}

/* Main Layout */
.designer-app {
    display: flex;
    min-height: calc(100vh - 64px); /* Fix: Use min-height to allow growing */
    position: relative;
}

/* Sidebar */
.designer-sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 1.5rem;
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 2.5rem;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 1.25rem;
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.template-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.template-card:hover {
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.template-card.active {
    border-color: #6366f1;
    background: #eef2ff;
}

.template-preview {
    width: 100%;
    height: 60px;
    background: #f3f4f6;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
}

/* Template preview shapes */
.template-preview.blog-header {
    aspect-ratio: 16/9;
}

.template-preview.social-square {
    aspect-ratio: 1/1;
}

.template-preview.story {
    aspect-ratio: 9/16;
    height: 80px;
}

.template-preview::before {
    content: '';
    position: absolute;
    inset: 10%;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-radius: 2px;
}

.template-name {
    font-size: 0.75rem;
    color: #4b5563;
    font-weight: 500;
    display: block;
}

.template-size {
    font-size: 0.625rem;
    color: #9ca3af;
    font-weight: 400;
    display: block;
    margin-top: 0.125rem;
}

/* Style Pills */
.style-pills {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.style-pill {
    background: #f3f4f6;
    border: 2px solid transparent;
    padding: 0.5rem 0.875rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.style-pill:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.style-pill.active {
    background: #eef2ff;
    border-color: #6366f1;
    color: #6366f1;
}


/* Main Designer Area */
.designer-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Toolbar - New Layout */
.designer-toolbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 2rem 1.5rem;
    flex-shrink: 0;
}

.prompt-section {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.textarea-wrapper {
    position: relative;
    width: 100%;
}

.prompt-field {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-bottom: 2rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.5;
    min-height: 120px;
    transition: all 0.2s;
    font-family: inherit;
}

.prompt-field:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.char-indicator {
    position: absolute;
    right: 0.75rem;
    bottom: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10;
}

/* Quick Start Chips */
.quick-start-chips {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.chips-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    flex-shrink: 0;
}

.chip-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quick-chip {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fbbf24;
    padding: 0.5rem 0.875rem;
    border-radius: 999px;
    font-size: 0.875rem;
    color: #78350f;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.quick-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
}

/* Generate Section */
.generate-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Quality Selector - Radio Button Style */
.quality-selector {
    display: flex;
    gap: 0.5rem;
}

.quality-option {
    position: relative;
}

.quality-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.quality-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    position: relative;
}

.quality-radio:checked + .quality-label {
    background: white;
    border-color: #6366f1;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.1);
}

.quality-icon {
    font-size: 1rem;
    line-height: 1;
}

.quality-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.quality-name {
    font-weight: 600;
    color: #111827;
    line-height: 1;
}

.quality-desc {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1;
}

.pro-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: none;
}

.pro-badge.available {
    display: block;
}

/* Generate Button */
.generate-button {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 0.875rem 2.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.generate-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.generate-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.generate-loading {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.generate-button.loading .generate-text {
    display: none;
}

.generate-button.loading .generate-loading {
    display: flex;
}

.mini-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Canvas Area */
.designer-canvas {
    flex: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow: auto;
}

.canvas-state {
    width: 100%;
    max-width: 800px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Empty State */
.empty-content {
    padding: 2rem 1rem;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.empty-content h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #111827;
}

.empty-description {
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

.empty-steps {
    display: flex;
    gap: 1.5rem;
    max-width: 300px;
    margin: 0 auto;
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.step-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.step-content {
    text-align: left;
}

.step-content h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.step-content p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.3;
}

/* Loading State */
.loading-content {
   padding: 2rem 1rem;
}

.premium-loader {
   width: 80px;
   height: 80px;
   margin: 0 auto 2rem;
   position: relative;
}

.loader-ring {
   position: absolute;
   inset: 0;
   border: 3px solid transparent;
   border-radius: 50%;
   border-top-color: #6366f1;
   animation: spin 1.5s linear infinite;
}

.loader-ring:nth-child(2) {
   inset: 10px;
   border-top-color: #8b5cf6;
   animation-duration: 2s;
   animation-direction: reverse;
}

.loader-ring:nth-child(3) {
   inset: 20px;
   border-top-color: #a78bfa;
   animation-duration: 2.5s;
}

.loading-content h3 {
   font-size: 1.25rem;
   font-weight: 600;
   color: #111827;
   margin-bottom: 1.5rem;
}

.progress-track {
   width: 300px;
   height: 4px;
   background: #e5e7eb;
   border-radius: 2px;
   margin: 0 auto 1rem;
   overflow: hidden;
}

.progress-bar {
   height: 100%;
   background: linear-gradient(90deg, #6366f1, #8b5cf6);
   border-radius: 2px;
   width: 0%;
   transition: width 0.3s ease;
}

.loading-tip {
   font-size: 0.875rem;
   color: #6b7280;
}

/* Result State */
.result-wrapper {
   position: relative;
   display: inline-block;
   border-radius: 12px;
   overflow: hidden;
   box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
   margin: 2rem 0;
   max-width: 100%;
   width: fit-content;
}

.result-image {
   display: block;
   max-width: 100%;
   width: auto;
   height: auto;
}

/* .result-overlay {
   position: absolute;
   inset: 0;
   background: linear-gradient(to bottom, transparent 60%, rgba(0, 0, 0, 0.7));
   opacity: 1;
   transition: opacity 0.3s;
} */

.result-wrapper:hover {
   background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.8));
}

.result-actions {
display: flex;
   gap: 1rem;
   margin-top: 1.5rem;
}

.result-action {
   display: flex;
   align-items: center;
   gap: 0.5rem;
   padding: 0.75rem 1.5rem;
   background: white;
   border: none;
   border-radius: 8px;
   font-weight: 600;
   cursor: pointer;
   transition: all 0.2s;
}

.result-action:hover {
   transform: translateY(-2px);
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.result-action.download {
   background: #10b981;
   color: white;
}

.result-action.regenerate {
   background: white;
   color: #111827;
}

/* Error State */
.error-content {
   padding: 2rem 1rem;
}

.error-icon {
   width: 80px;
   height: 80px;
   margin: 0 auto 2rem;
   background: #fee2e2;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   color: #dc2626;
}

.error-content h3 {
   font-size: 1.5rem;
   font-weight: 600;
   color: #111827;
   margin-bottom: 0.5rem;
}

.error-content p {
   color: #6b7280;
   margin-bottom: 2rem;
}

.retry-button {
   background: #dc2626;
   color: white;
   border: none;
   padding: 0.75rem 2rem;
   border-radius: 8px;
   font-weight: 600;
   cursor: pointer;
   transition: all 0.2s;
}

.retry-button:hover {
   background: #b91c1c;
   transform: translateY(-1px);
}

/* Help Button */
.help-button {
   position: fixed;
   bottom: 2rem;
   right: 2rem;
   width: 56px;
   height: 56px;
   background: white;
   border: 1px solid #e5e7eb;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   cursor: pointer;
   transition: all 0.2s;
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.help-button:hover {
   transform: translateY(-2px);
   box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

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

/* Mobile Responsive */
@media (max-width: 768px) {
    .designer-app {
        display: block;
        min-height: calc(100vh - 64px); /* Fix */
        margin-bottom: 0;
    }
    
    .designer-sidebar {
        width: 100%;
        height: auto; /* Fix */
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 0.75rem;
        position: relative;
        flex: none;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .designer-main {
        width: 100%;
        height: auto; /* Fix */
        flex: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .sidebar-section {
        margin-bottom: 0.75rem;
        border-bottom: 1px solid #f3f4f6;
        padding-bottom: 0.5rem;
        flex-shrink: 0;
    }
    
    .sidebar-section:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }
    
    .mobile-prompt-section {
        display: block;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid #f3f4f6;
    }
    
    .mobile-prompt-section .prompt-field {
        width: 100%;
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 16px;
        border: 1px solid #d1d5db;
        border-radius: 8px;
        box-sizing: border-box;
        min-height: 80px;
        resize: vertical;
        margin-bottom: 0.75rem;
    }
    
    .mobile-prompt-section .char-indicator {
        position: absolute;
        right: 12px;
        bottom: 8px;
        font-size: 12px;
        color: #6b7280;
        background: rgba(255, 255, 255, 0.9);
        padding: 0.125rem 0.375rem;
        border-radius: 4px;
        pointer-events: none;
        z-index: 10;
    }
    
    .mobile-prompt-section .quick-start-chips {
        display: flex;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .mobile-prompt-section .chips-label {
        font-size: 0.75rem;
        color: #6b7280;
        margin-top: 0.125rem;
        flex-shrink: 0;
    }
    
    .mobile-prompt-section .chip-buttons {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        flex: 1;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .mobile-prompt-section .chip-buttons::-webkit-scrollbar {
        display: none;
    }
    
    .mobile-prompt-section .quick-chip {
        flex-shrink: 0;
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
        background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
        border: 1px solid #fbbf24;
        border-radius: 999px;
        color: #78350f;
        font-weight: 500;
        white-space: nowrap;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .mobile-prompt-section .quick-chip:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
        background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    }
    
    .mobile-prompt-section .generate-section {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .mobile-prompt-section .quality-selector {
        flex: 1;
        min-width: 200px;
        gap: 0.375rem;
        display: flex;
    }
    
    .mobile-prompt-section .quality-label {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
        gap: 0.375rem;
        flex: 1;
        display: flex;
        align-items: center;
        background: #f3f4f6;
        border: 2px solid transparent;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .mobile-prompt-section .quality-radio:checked + .quality-label {
        background: white;
        border-color: #6366f1;
        box-shadow: 0 1px 3px rgba(99, 102, 241, 0.1);
    }
    
    .mobile-prompt-section .generate-button {
        flex-shrink: 0;
        padding: 12px 20px;
        background: #6366f1;
        color: white;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        font-size: 0.875rem;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .mobile-prompt-section .generate-button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }
    
    .mobile-prompt-section .generate-loading {
        display: none;
        align-items: center;
        gap: 0.5rem;
    }
    
    .mobile-prompt-section .generate-button.loading .generate-text {
        display: none;
    }
    
    .mobile-prompt-section .generate-button.loading .generate-loading {
        display: flex;
    }
    
    .mobile-prompt-section .mini-spinner {
        width: 16px;
        height: 16px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top-color: white;
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }
    
    .sidebar-title {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: #374151;
        text-transform: uppercase;
        letter-spacing: 0.025em;
    }
    
    .template-grid {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    .template-grid::-webkit-scrollbar {
        display: none; /* WebKit */
    }
    
    .template-card {
        flex-shrink: 0;
        width: 65px;
        padding: 0.3rem;
        font-size: 10px;
        border: 1px solid #e5e7eb;
        border-radius: 6px;
        text-align: center;
    }
    
    .template-preview {
        height: 35px;
        margin-bottom: 0.2rem;
    }
    
    .template-card.active {
        border-color: #6366f1;
        background-color: #eff6ff;
    }
    
    .style-pills {
        display: flex;
        gap: 0.25rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* Internet Explorer 10+ */
    }
    
    .style-pills::-webkit-scrollbar {
        display: none; /* WebKit */
    }
    
    .style-pill {
        flex-shrink: 0;
        padding: 0.375rem 0.75rem;
        font-size: 12px;
        border-radius: 16px;
        border: 1px solid #e5e7eb;
        background: white;
        white-space: nowrap;
    }
    
    .style-pill.active {
        background: #6366f1;
        color: white;
        border-color: #6366f1;
    }
    
    /* Hide desktop toolbar on mobile */
    .designer-toolbar {
        display: none;
    }
    
    .designer-canvas {
        padding: 0.75rem;
    }
    
    .result-wrapper {
        margin: 1rem 0;
        width: 100%;
        max-width: calc(100vw - 1.5rem);
    }
    
    .result-image {
        max-height: 35vh;
        width: 100%;
        object-fit: contain;
    }
    
    .help-button {
        display: none;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .result-image {
        max-height: 45vh;
    }
}

/* Desktop specific adjustments */
@media (min-width: 769px) {
    .mobile-prompt-section {
        display: none !important;
    }
    
    .designer-main {
        min-height: 0; /* Important for flexbox */
    }
    
    .designer-canvas {
        min-height: 0; /* Allow proper scrolling */
    }
    
    .result-wrapper {
        margin: 2rem 0;
        max-width: 90%;
        max-height: 60vh;
    }
    
    .result-image {
        max-height: 60vh;
        max-width: 100%;
        object-fit: contain;
    }
}






/* In designer.css, add these rules */

/* Add margin around the canvas for breathing room */
.designer-canvas {
    margin: 1.5rem;
    border-radius: 12px;
    border: 1px dashed #d1d5db; /* A subtle border to define the area */
}

/* Prevent the result image from causing horizontal scroll */
.result-wrapper {
    max-width: 100%;
    overflow-x: hidden;
}

/* Adjust the empty state steps to prevent overflow */
.empty-steps {
    display: flex;
    justify-content: center;
    gap: 1rem; /* Reduce gap */
    max-width: 100%;
}

.step-item {
    text-align: center;
    max-width: 130px; /* Constrain width */
}

.step-content h4 {
    font-size: 0.875rem; /* Make heading smaller */
}

.step-content p {
    font-size: 0.75rem; /* Make paragraph smaller */
}





/* Add this to your designer.css file */
.designer-sidebar.editing-mode .sidebar-section:first-child, /* Hides Templates */
.designer-sidebar.editing-mode .sidebar-section:nth-child(2) { /* Hides Style */
    display: none;
}

.designer-toolbar.editing-mode .quick-start-chips {
    display: none;
}

/* For Mobile Toolbar */
.mobile-prompt-section.editing-mode .quick-start-chips {
    display: none;
}

.secondary-button { /* Example styling for the new button */
    background: #f3f4f6;
    color: #374151;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.secondary-button:hover {
    background: #e5e7eb;
}


/* Styling for the post-login message overlay */
.post-login-message {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    border-radius: 12px; /* Matches the result-wrapper */
}

.post-login-message h3 {
    font-size: 1.5rem;
    color: #111827;
    margin-bottom: 0.5rem;
}

.post-login-message p {
    color: #4b5563;
    max-width: 400px;
    margin-bottom: 1.5rem;
}
