/* Custom styling for Editor.js blocks in the editor */

/* Callout (Warning) type selector */
.ce-callout-type {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.9em;
    background-color: #fff;
}

.ce-callout-type option {
    padding: 4px;
}

.ce-callout {
    margin: 15px 0;
    border-radius: 4px;
}

/* Table styles */
.editor-rendered-table .article-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95em;
    border: 1px solid #ddd;
}

.editor-rendered-table .article-table th,
.editor-rendered-table .article-table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

.editor-rendered-table .article-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.editor-rendered-table .article-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Warning/Callout block styles */
.editor-rendered-warning .article-warning-block {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-radius: 4px;
}

.editor-rendered-warning .warning-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Quote block styles */
.editor-rendered-quote blockquote {
    border-left: 3px solid #2a82e2;
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    color: #555;
    font-style: italic;
    font-size: 1.1em;
    background-color: #f9f9f9;
    border-radius: 0 4px 4px 0;
}

.editor-rendered-quote blockquote footer {
    font-size: 0.9em;
    font-style: normal;
    margin-top: 0.5rem;
    text-align: right;
    color: #777;
}

/* Delimiter styles */
.editor-rendered-delimiter .article-delimiter {
    margin: 2rem auto;
    width: 100px;
    border: none;
    border-top: 2px solid #e0e0e0;
}

/* Hide original Editor.js blocks when we have our rendered version */
.ce-block[data-table-rendered="true"] .ce-table,
.ce-block[data-warning-rendered="true"] .ce-warning,
.ce-block[data-delimiter-rendered="true"] .ce-delimiter,
.ce-block[data-quote-rendered="true"] .ce-quote {
    display: none;
}

/* Editor.js inline toolbar improvements */
.ce-toolbar {
    border-radius: 4px;
    /* overflow: hidden; */ /* SUSPECT: This might hide block tunes/plus button */
}

.ce-toolbar__plus:hover,
.ce-toolbar__settings-btn:hover {
    background-color: #f0f0f0;
}

/* Editor.js block toolbar improvements */
.ce-block:hover {
    background-color: #f9f9f9;
    border-radius: 4px;
}

/* Tooltip styles for help icons */
.tooltip-icon {
    color: #999;
    font-size: 14px;
    margin-left: 5px;
    cursor: help;
    transition: color 0.2s ease;
}

.tooltip-icon:hover {
    color: #2a82e2;
}

.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    line-height: 1.4;
    font-weight: normal;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Styling for the Warning/Callout tool within the editor */
.ce-warning {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    padding: 15px;
    background-color: var(--card-background, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ce-warning__title,
.ce-warning__message {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 0.95em;
    background-color: #f8f9fa; /* Light background for inputs */
}

.ce-warning__title:focus,
.ce-warning__message:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
    box-shadow: 0 0 0 1px var(--primary-color, #4CAF50);
}

/* Style the select dropdown for warning type */
.ce-warning .cdx-select {
    width: 100%;
    margin-bottom: 10px;
}

.ce-warning .cdx-select select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    font-size: 0.9em;
    background-color: #f8f9fa;
    cursor: pointer;
}

.ce-warning .cdx-select select:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
}

/* Ensure Header tool tune settings (H1-H6 buttons) are visible */
.ce-settings {
    /* This is the tunes popup panel */
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 10000 !important; /* Ensure it's above other editor elements */
}

.ce-settings__button {
    /* This is a generic button in the tunes panel */
    display: flex !important; /* Use flex for alignment if needed by the tool's icons/text */
    visibility: visible !important;
    opacity: 1 !important;
    padding: 8px 10px !important; /* Ensure padding is not collapsing them */
    border: 1px solid transparent !important; /* Prevent borders from hiding them if they exist */
}

/* Specifically target header level buttons if they have such classes */
/* The official @editorjs/header tool renders buttons, not specific classes like .ce-settings__button--level-1 */
/* Instead, it adds data-level attributes. We need to ensure these buttons are visible generally. */
/* The .ce-settings__button should cover them. */

/* Editor.js inline toolbar improvements */
.ce-toolbar {
    border-radius: 4px;
    /* overflow: hidden; */ /* SUSPECT: This might hide block tunes/plus button */
}

.ce-toolbar__plus:hover,
.ce-toolbar__settings-btn:hover {
    background-color: #f0f0f0;
}

/* Editor.js block toolbar improvements */
.ce-block:hover {
    background-color: #f9f9f9;
    border-radius: 4px;
}

/* Tooltip styles for help icons */
.tooltip-icon {
    color: #999;
    font-size: 14px;
    margin-left: 5px;
    cursor: help;
    transition: color 0.2s ease;
}

.tooltip-icon:hover {
    color: #2a82e2;
}

.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    line-height: 1.4;
    font-weight: normal;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Styling for the Warning/Callout tool within the editor */
.ce-warning {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    padding: 15px;
    background-color: var(--card-background, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.ce-warning__title,
.ce-warning__message {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 0.95em;
    background-color: #f8f9fa; /* Light background for inputs */
}

.ce-warning__title:focus,
.ce-warning__message:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
    box-shadow: 0 0 0 1px var(--primary-color, #4CAF50);
}

/* Style the select dropdown for warning type */
.ce-warning .cdx-select {
    width: 100%;
    margin-bottom: 10px;
}

.ce-warning .cdx-select select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    font-size: 0.9em;
    background-color: #f8f9fa;
    cursor: pointer;
}

.ce-warning .cdx-select select:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
}

/* Embed block styles */
.article-embed-container {
    margin: 1.5rem 0;
    text-align: center;
    position: relative;
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.article-embed-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-embed-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
}

.article-embed-caption {
    margin-top: 10px;
    font-size: 0.9em;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* Editor.js embed tool styling */
.ce-embed {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
    padding: 15px;
    background-color: var(--card-background, #fff);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin: 15px 0;
}

.ce-embed__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    font-size: 0.95em;
    background-color: #f8f9fa;
    margin-bottom: 10px;
}

.ce-embed__input:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
    box-shadow: 0 0 0 1px var(--primary-color, #4CAF50);
}

.ce-embed__caption {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 4px;
    font-size: 0.9em;
    background-color: #f8f9fa;
    margin-top: 10px;
}

.ce-embed__caption:focus {
    outline: none;
    border-color: var(--primary-color, #4CAF50);
    box-shadow: 0 0 0 1px var(--primary-color, #4CAF50);
}

.ce-embed__content {
    margin: 10px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Responsive embed styles */
@media (max-width: 768px) {
    .article-embed-container {
        max-width: 100%;
        margin: 1rem 0;
    }
    
    .article-embed-wrapper {
        border-radius: 6px;
    }
    
    .article-embed-wrapper iframe {
        border-radius: 6px;
    }
}

/* Task List Block Styles */
.article-task-list {
    margin: 1.5rem 0;
    padding: 0;
    list-style: none;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    padding: 6px 0;
    line-height: 1.5;
    transition: background-color 0.2s ease;
}

.task-item:hover {
    background-color: #f9f9f9;
    border-radius: 4px;
    padding-left: 6px;
    padding-right: 6px;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #4CAF50;
    flex-shrink: 0;
    cursor: not-allowed; /* Indicates disabled state on published articles */
}

.task-text {
    flex: 1;
    font-size: 1em;
    color: #333;
    line-height: 1.5;
    margin: 0;
}

.task-text.checked {
    text-decoration: line-through;
    color: #999;
}

/* Heading 4 and 5 Styles */
h4 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 1.5rem 0 1rem 0;
    color: #2d3748;
    line-height: 1.3;
}

h5 {
    font-size: 1.125em;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem 0;
    color: #2d3748;
    line-height: 1.3;
}

/* Responsive Task List Styles */
@media (max-width: 768px) {
    .task-item {
        gap: 8px;
        margin-bottom: 6px;
        padding: 4px 0;
    }
    
    .task-checkbox {
        width: 16px;
        height: 16px;
    }
    
    .task-text {
        font-size: 0.95em;
    }
    
    h4 {
        font-size: 1.2em;
        margin: 1.25rem 0 0.75rem 0;
    }
    
    h5 {
        font-size: 1.1em;
        margin: 1rem 0 0.5rem 0;
    }
}