/**
 * NextGenBlock - Editor.js Tool Styles
 */

/* Wrapper */
.nextgenblock-wrapper {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
    margin: 10px 0;
}

/* Header */
.nextgenblock-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.nextgenblock-column-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nextgenblock-column-control label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
}

.nextgenblock-columns-select {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    min-width: 60px;
}

.nextgenblock-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.nextgenblock-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.nextgenblock-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.nextgenblock-btn-primary {
    background: #003F5E;
    color: white;
    border-color: #003F5E;
}

.nextgenblock-btn-primary:hover {
    background: #002b42;
    border-color: #002b42;
}

.nextgenblock-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Grid */
.nextgenblock-grid {
    display: grid;
    gap: 16px;
    min-height: 100px;
}

.nextgenblock-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
    font-style: italic;
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

/* Card */
.nextgenblock-card {
    position: relative;
    background: white;
    border: 2px solid #222;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}

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

.nextgenblock-card-placeholder {
    background: #e0f0ff;
    border: 2px dashed #3498db;
    border-radius: 6px;
    min-height: 150px;
}

/* Card Handle */
.nextgenblock-card-handle {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.9);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nextgenblock-card:hover .nextgenblock-card-handle {
    opacity: 1;
}

.nextgenblock-card-handle svg {
    width: 14px;
    height: 14px;
    fill: #666;
}

/* Card Image */
.nextgenblock-card-image {
    height: 120px;
    background-color: #f0f0f0;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 2px solid #222;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nextgenblock-card-image-empty {
    color: #ccc;
}

.nextgenblock-card-image-empty svg {
    width: 48px;
    height: 48px;
    stroke: #ccc;
}

/* Card Content */
.nextgenblock-card-content {
    padding: 12px;
}

.nextgenblock-card-title {
    font-weight: 600;
    font-size: 14px;
    color: #222;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nextgenblock-card-desc {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

/* Card Actions */
.nextgenblock-card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.nextgenblock-card:hover .nextgenblock-card-actions {
    opacity: 1;
}

.nextgenblock-card-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.95);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.nextgenblock-card-btn:hover {
    background: #e0e0e0;
}

.nextgenblock-card-btn svg {
    width: 14px;
    height: 14px;
    fill: #333;
}

.nextgenblock-card-btn-danger:hover {
    background: #fee;
}

.nextgenblock-card-btn-danger:hover svg {
    stroke: #c00;
}

/* Modal Overlay - z-index must be higher than columns modal (2000) */
.nextgenblock-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 800;
}

/* Modal */
.nextgenblock-modal {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: visible;
}

.nextgenblock-modal-library {
    max-width: 500px;
    min-height: 400px;
}

/* Modal Header */
.nextgenblock-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.nextgenblock-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #222;
}

.nextgenblock-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.nextgenblock-modal-close:hover {
    background: #f0f0f0;
}

.nextgenblock-modal-close svg {
    stroke: #666;
}

/* Modal Tabs */
.nextgenblock-modal-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 20px;
}

.nextgenblock-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.nextgenblock-tab:hover {
    color: #333;
}

.nextgenblock-tab.active {
    color: #003F5E;
    border-bottom-color: #003F5E;
    font-weight: 600;
}

/* Modal Body */
.nextgenblock-modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: visible;
    flex: 1;
}

/* Tab Content */
.nextgenblock-tab-content {
    display: none;
}

.nextgenblock-tab-content.active {
    display: block;
}

/* Form Groups */
.nextgenblock-form-group {
    margin-bottom: 16px;
}

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

/* Reduce gap between consecutive select boxes in link section */
.nextgenblock-link-paginasoort + .nextgenblock-link-paginasoort {
    margin-top: -4px;
}

.nextgenblock-form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    margin-bottom: 6px;
}

.nextgenblock-form-group hr {
    border: none;
    border-top: 1px solid #e0e0e0;
    margin: 20px 0;
}

/* Inputs */
.nextgenblock-input,
.nextgenblock-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.nextgenblock-select {
    width: 100%;
    padding: 0;
    border: none;
    font-size: 14px;
    box-sizing: border-box;
}

.nextgenblock-input:focus,
.nextgenblock-textarea:focus {
    border-color: #003F5E;
    outline: none;
}

.nextgenblock-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Radio Groups */
.nextgenblock-radio-group {
    display: flex;
    gap: 20px;
}

.nextgenblock-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

.nextgenblock-radio-group input[type="radio"] {
    margin: 0;
}

/* Image Upload */
.nextgenblock-image-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nextgenblock-image-preview {
    width: 100%;
    height: 150px;
    background: #f5f5f5;
    border: 2px dashed #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.nextgenblock-image-preview:hover {
    border-color: #003F5E;
    background-color: #f0f7fa;
}

.nextgenblock-image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.nextgenblock-image-preview span {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 10px;
}

/* Modal Footer */
.nextgenblock-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 0 0 8px 8px;
}

/* Library Preview */
.nextgenblock-library-preview {
    margin-top: 16px;
}

.nextgenblock-preview-card {
    background: white;
    border: 2px solid #222;
    border-radius: 0 0 24px 0;
    overflow: hidden;
    text-align: center;
}

.nextgenblock-preview-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.nextgenblock-preview-card h4 {
    margin: 0;
    padding: 16px 16px 8px;
    color: #222;
    font-size: 16px;
    font-weight: 600;
}

.nextgenblock-preview-card p {
    margin: 0;
    padding: 0 16px 16px;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Error state */
.nextgenblock-library-preview .error {
    color: #c00;
    font-style: italic;
}

/* Chosen overrides for modal */
.nextgenblock-modal .chosen-container {
    width: 100% !important;
    font-size: 14px;
}

/* Ensure Chosen dropdown is positioned absolutely and doesn't affect layout */
.nextgenblock-modal .chosen-container .chosen-drop {
    position: absolute !important;
    top: 100% !important;
    left: 0;
    width: 100%;
    border-top: 1px solid #ccc;
    z-index: 10010;
}

/* When dropdown is closed, ensure it doesn't take space */
.nextgenblock-modal .chosen-container:not(.chosen-with-drop) .chosen-drop {
    display: none;
}

.nextgenblock-modal .chosen-container-single .chosen-single {
    height: 44px;
    line-height: 42px;
    padding: 0 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    background-image: none;
    box-shadow: none;
}

.nextgenblock-modal .chosen-container-active .chosen-single {
    border-color: #003F5E;
}

.nextgenblock-modal .chosen-container-active.chosen-with-drop .chosen-single {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: #ccc;
}

.nextgenblock-modal .chosen-container-single .chosen-single span {
    margin-right: 30px;
    line-height: 42px;
}

.nextgenblock-modal .chosen-container-single .chosen-single div {
    width: 30px;
    top: 0;
    right: 0;
    height: 100%;
}

.nextgenblock-modal .chosen-container-single .chosen-single div b {
    background-position: 0 12px;
}

.nextgenblock-modal .chosen-container-active.chosen-with-drop .chosen-single div b {
    background-position: -18px 12px;
}

.nextgenblock-modal .chosen-drop {
    border-color: #ccc;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.nextgenblock-modal .chosen-container-single .chosen-search {
    padding: 8px;
}

.nextgenblock-modal .chosen-container-single .chosen-search input[type="text"] {
    height: 38px;
    line-height: 38px;
    padding: 0 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.nextgenblock-modal .chosen-results {
    max-height: 200px;
    margin: 0;
    padding: 0;
}

.nextgenblock-modal .chosen-results li {
    padding: 10px 12px;
    line-height: 1.4;
}

.nextgenblock-modal .chosen-results li.highlighted {
    background: #003F5E;
    background-image: none;
}

.nextgenblock-modal .chosen-results li.no-results {
    background: #f5f5f5;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .nextgenblock-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .nextgenblock-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .nextgenblock-radio-group {
        flex-direction: column;
        gap: 10px;
    }
}
