/**
 * Widget Gallery Modal Styles
 * 
 * Elegant modal design for widget selection with gallery layout
 */

/* Modal Overlay */
.nett-widget-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 999999;
    animation: nettFadeIn 0.3s ease;
}

.nett-widget-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Modal Container */
.nett-widget-modal {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: nettSlideUp 0.4s ease;
    overflow: hidden;
}

/* Modal Header */
.nett-widget-modal-header {
    padding: 30px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nett-widget-modal-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nett-widget-modal-title i {
    font-size: 28px;
}

.nett-widget-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nett-widget-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Search Bar */
.nett-widget-search {
    padding: 20px 40px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.nett-widget-search-input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 2px solid #e9ecef;
    border-radius: 50px;
    font-size: 15px;
    transition: all 0.3s ease;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="gray" stroke-width="2"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.35-4.35"/></svg>');
    background-repeat: no-repeat;
    background-position: 15px center;
}

.nett-widget-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Modal Body */
.nett-widget-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px 40px;
}

/* Widget Gallery Grid */
.nett-widget-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

/* Widget Card */
.nett-widget-card {
    background: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.nett-widget-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.nett-widget-card.selected {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.nett-widget-card.selected::after {
    content: '✓';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Widget Preview */
.nett-widget-preview {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.nett-widget-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nett-widget-preview-placeholder {
    font-size: 64px;
    color: rgba(0, 0, 0, 0.15);
}

.nett-widget-category-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
}

/* Widget Info */
.nett-widget-info {
    padding: 20px;
}

.nett-widget-name {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.nett-widget-description {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Prompt Editor Section */
.nett-widget-prompt-section {
    margin-top: 30px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
    display: none;
}

.nett-widget-prompt-section.active {
    display: block;
    animation: nettFadeIn 0.3s ease;
}

.nett-widget-prompt-label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nett-widget-prompt-label i {
    color: #667eea;
}

.nett-widget-prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
}

.nett-widget-prompt-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.nett-widget-prompt-hint {
    font-size: 12px;
    color: #868e96;
    margin: 8px 0 0 0;
    font-style: italic;
}

/* Modal Footer */
.nett-widget-modal-footer {
    padding: 24px 40px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nett-widget-selection-info {
    font-size: 14px;
    color: #6b7280;
}

.nett-widget-selection-info strong {
    color: #10b981;
    font-weight: 600;
}

.nett-widget-modal-actions {
    display: flex;
    gap: 12px;
}

.nett-widget-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nett-widget-btn-cancel {
    background: #ffffff;
    color: #495057;
    border: 2px solid #dee2e6;
}

.nett-widget-btn-cancel:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.nett-widget-btn-save {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.nett-widget-btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.nett-widget-btn-save:disabled {
    background: #dee2e6;
    color: #adb5bd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading State */
.nett-widget-loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.nett-widget-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: nettSpin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Empty State */
.nett-widget-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.nett-widget-empty i {
    font-size: 64px;
    color: #dee2e6;
    margin-bottom: 16px;
}

/* Animations */
@keyframes nettFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes nettSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .nett-widget-modal {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .nett-widget-modal-header,
    .nett-widget-modal-body,
    .nett-widget-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .nett-widget-gallery {
        grid-template-columns: 1fr;
    }
    
    .nett-widget-modal-footer {
        flex-direction: column;
        gap: 12px;
    }
    
    .nett-widget-modal-actions {
        width: 100%;
    }
    
    .nett-widget-btn {
        flex: 1;
    }
}
