/* ===========================================
   PORTFOLIO MANAGER STYLES
   =========================================== */

/* Main Layout */
.manager-main {
    padding-top: 80px;
    min-height: 100vh;
}

.manager-container {
    display: grid;
    grid-template-columns: 260px 1fr 50%;
    gap: 0;
    height: calc(100vh - 80px);
}

/* Sidebar - Portfolio List */
.portfolio-list-panel {
    background: rgba(255,255,255,0.03);
    border-right: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
    margin-bottom: 1rem;
}

.btn-create-portfolio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-create-portfolio:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99,102,241,0.4);
}

.btn-create-portfolio svg {
    width: 18px;
    height: 18px;
}

.portfolio-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.portfolio-item {
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.portfolio-item:hover {
    background: rgba(255,255,255,0.08);
}

.portfolio-item.active {
    border-color: #6366F1;
    background: rgba(99,102,241,0.1);
}

.portfolio-item-title {
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.portfolio-item-url {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    word-break: break-all;
}

/* Editor Panel */
.editor-panel {
    overflow-y: auto;
    padding: 2rem;
    background: rgba(0,0,0,0.2);
}

.editor-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 2rem;
}

.editor-empty .empty-icon {
    width: 100px;
    height: 100px;
    color: rgba(255,255,255,0.2);
    margin-bottom: 2rem;
}

.editor-empty .empty-icon svg {
    width: 100%;
    height: 100%;
}

.editor-empty h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.editor-empty p {
    color: rgba(255,255,255,0.6);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.editor-content.hidden,
.editor-empty.hidden {
    display: none;
}

/* Editor Sections */
.editor-section {
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.editor-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: white;
}

.section-hint {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.5);
    margin-bottom: 1rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: white;
    font-size: 0.9375rem;
    transition: border-color 0.2s, background 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366F1;
    background: rgba(255,255,255,0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255,255,255,0.4);
}

.slug-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    overflow: hidden;
}

.slug-prefix {
    padding: 0.75rem 0 0.75rem 1rem;
    color: rgba(255,255,255,0.5);
    font-size: 0.875rem;
    white-space: nowrap;
}

.slug-input-wrapper input {
    border: none;
    background: transparent;
    padding-left: 0;
}

.slug-input-wrapper input:focus {
    border: none;
    background: transparent;
}

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

.layout-option {
    aspect-ratio: 4/3;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    text-align: center;
}

.layout-option:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.2);
}

.layout-option.active {
    border-color: #6366F1;
    background: rgba(99,102,241,0.1);
}

.layout-option .layout-icon {
    width: 40px;
    height: 30px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.layout-option .layout-icon .block {
    background: rgba(255,255,255,0.5);
    border-radius: 2px;
}

.layout-option .layout-name {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.2;
}

/* Color Pickers */
.color-pickers {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.color-picker-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.color-picker-group label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
}

.color-picker-group input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    background: transparent;
}

.color-picker-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-group input[type="color"]::-webkit-color-swatch {
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px;
}

/* Newsletter Selector */
.newsletter-selector {
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.newsletter-selector-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.newsletter-selector-item:last-child {
    margin-bottom: 0;
}

.newsletter-selector-item:hover {
    background: rgba(255,255,255,0.1);
}

.newsletter-selector-item.selected {
    background: rgba(99,102,241,0.2);
    border: 1px solid rgba(99,102,241,0.3);
}

.newsletter-selector-item .checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.newsletter-selector-item.selected .checkbox {
    background: #6366F1;
    border-color: #6366F1;
}

.newsletter-selector-item.selected .checkbox svg {
    display: block;
}

.newsletter-selector-item .checkbox svg {
    display: none;
    width: 14px;
    height: 14px;
    color: white;
}

.newsletter-selector-item .nl-title {
    flex: 1;
    font-size: 0.9375rem;
    color: white;
}

.newsletter-selector-item .nl-pages {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

/* Selected Newsletters (Sortable) */
.selected-newsletters {
    min-height: 100px;
}

.selected-newsletter-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: grab;
}

.selected-newsletter-item:active {
    cursor: grabbing;
}

.selected-newsletter-item.dragging {
    opacity: 0.5;
}

.selected-newsletter-item .drag-handle {
    color: rgba(255,255,255,0.3);
}

.selected-newsletter-item .drag-handle svg {
    width: 20px;
    height: 20px;
}

.selected-newsletter-item .nl-info {
    flex: 1;
}

.selected-newsletter-item .nl-title {
    font-size: 0.9375rem;
    color: white;
}

.selected-newsletter-item .star-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: rgba(255,255,255,0.3);
    transition: color 0.2s;
}

.selected-newsletter-item .star-btn:hover {
    color: rgba(255,255,255,0.6);
}

.selected-newsletter-item .star-btn.featured {
    color: #F59E0B;
}

.selected-newsletter-item .star-btn svg {
    width: 20px;
    height: 20px;
}

.selected-newsletter-item .remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: rgba(255,255,255,0.3);
    transition: color 0.2s;
}

.selected-newsletter-item .remove-btn:hover {
    color: #EF4444;
}

.selected-newsletter-item .remove-btn svg {
    width: 18px;
    height: 18px;
}

/* Toggle Options */
.toggle-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #6366F1;
}

.toggle-label {
    font-size: 0.9375rem;
    color: rgba(255,255,255,0.8);
}

/* Editor Actions */
.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 1rem;
}

.action-right {
    display: flex;
    gap: 0.75rem;
}

.btn-primary,
.btn-secondary,
.btn-delete {
    padding: 0.875rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99,102,241,0.4);
}

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

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}

.btn-delete {
    background: rgba(239,68,68,0.1);
    color: #EF4444;
    border: 1px solid rgba(239,68,68,0.2);
}

.btn-delete:hover {
    background: rgba(239,68,68,0.2);
}

/* Preview Panel */
.preview-panel {
    background: rgba(0,0,0,0.3);
    border-left: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.preview-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.device-switcher {
    display: flex;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 3px;
}

.device-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: rgba(255,255,255,0.4);
    transition: all 0.2s;
}

.device-btn:hover {
    color: rgba(255,255,255,0.7);
}

.device-btn.active {
    background: rgba(99,102,241,0.3);
    color: #6366F1;
}

.preview-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    transition: color 0.2s;
    border-radius: 6px;
}

.preview-link:hover {
    color: #6366F1;
    background: rgba(255,255,255,0.05);
}

.preview-frame {
    flex: 1;
    padding: 1.5rem;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: repeating-conic-gradient(rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%) 50% / 20px 20px;
}

.preview-device-frame {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}

.preview-frame[data-device="mobile"] .preview-device-frame {
    max-width: 375px;
}

.preview-frame[data-device="tablet"] .preview-device-frame {
    max-width: 768px;
}

.preview-frame[data-device="desktop"] .preview-device-frame {
    max-width: 100%;
}

.preview-device-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    background: #0F172A;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* Responsive */
@media (max-width: 1600px) {
    .manager-container {
        grid-template-columns: 240px 1fr 45%;
    }
}

@media (max-width: 1400px) {
    .manager-container {
        grid-template-columns: 220px 1fr 40%;
    }
}

@media (max-width: 1200px) {
    .manager-container {
        grid-template-columns: 1fr;
    }

    .portfolio-list-panel {
        display: none;
    }

    .preview-panel {
        display: none;
    }

    .layout-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .layout-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .color-pickers {
        justify-content: center;
    }

    .editor-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .action-right {
        width: 100%;
    }

    .action-right button {
        flex: 1;
    }
}
