/* Constructor Styles */

.constructor-page {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.constructor-sidebar {
    width: 360px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header .logo {
    font-size: 1.25rem;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.sidebar-section {
    margin-bottom: var(--space-xl);
}

.sidebar-section h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

/* Template Selector */
.template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.template-item {
    aspect-ratio: 9/16;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.template-item:hover {
    border-color: var(--primary);
}

.template-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.template-item.selected::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
}

/* Color Picker */
.color-options {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-option:hover,
.color-option.selected {
    border-color: white;
    transform: scale(1.1);
}

/* Preview Area */
.constructor-preview {
    flex: 1;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    position: relative;
}

.preview-container {
    width: 375px;
    height: 812px;
    background: var(--bg-card);
    border-radius: 40px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.device-frame {
    position: absolute;
    inset: 0;
    border: 12px solid #1a1a2e;
    border-radius: 40px;
    pointer-events: none;
}

.preview-screen {
    height: 100%;
    overflow-y: auto;
    padding: 44px 0 34px;
}

/* Preview App Content */
.preview-app {
    min-height: 100%;
    background: white;
    color: #1a1a2e;
}

.preview-header {
    padding: var(--space-lg);
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.preview-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: var(--radius-xl);
    margin: 0 auto var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-logo .placeholder {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.preview-business-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.preview-description {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: var(--space-xs);
}

.preview-contact {
    padding: var(--space-lg);
    background: #f8f9fa;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.preview-contact-item {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.preview-contact-item svg {
    display: block;
    margin: 0 auto var(--space-xs);
}

.preview-section {
    padding: var(--space-lg);
}

.preview-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: #1a1a2e;
}

.preview-products {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.preview-product {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    background: #f8f9fa;
    border-radius: var(--radius-lg);
}

.preview-product-image {
    width: 80px;
    height: 80px;
    background: #e9ecef;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.preview-product-info {
    flex: 1;
}

.preview-product-info h4 {
    font-size: 0.875rem;
    margin: 0 0 var(--space-xs);
    color: #1a1a2e;
}

.preview-product-info p {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0;
}

.preview-product-price {
    font-weight: 600;
    color: var(--primary);
    margin-top: var(--space-xs);
}

/* Products Editor */
.products-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.product-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.product-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.product-item-header h4 {
    font-size: 0.875rem;
    margin: 0;
}

.product-item-actions {
    display: flex;
    gap: var(--space-xs);
}

.product-item-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
}

.product-item-actions button:hover {
    color: var(--text-primary);
}

.add-product-btn {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-elevated);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-product-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.add-product-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-lg);
}

.tab {
    padding: var(--space-md);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    transition: color var(--transition-fast);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-light);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Calendar Config */
.day-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}

.day-btn {
    padding: var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.day-btn:hover {
    border-color: var(--primary);
}

.day-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.time-slots {
    max-height: 200px;
    overflow-y: auto;
}

.time-slot {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
}

.time-slot:last-child {
    border: none;
}

.time-slot input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.time-slot label {
    flex: 1;
    font-size: 0.875rem;
}

.time-slot input[type="number"] {
    width: 60px;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-align: center;
}

/* Help Modal */
.help-modal .modal {
    max-width: 600px;
}

.help-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.help-step {
    display: flex;
    gap: var(--space-lg);
}

.help-step-number {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.help-step-content h4 {
    margin: 0 0 var(--space-xs);
}

.help-step-content p {
    margin: 0;
    font-size: 0.9375rem;
}

/* Responsive */
@media (max-width: 900px) {
    .constructor-page {
        flex-direction: column;
    }

    .constructor-sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
    }

    .constructor-preview {
        padding: var(--space-md);
    }

    .preview-container {
        width: 100%;
        max-width: 375px;
        height: auto;
        aspect-ratio: 9/19;
    }
}