/**
 * BW Advanced Tabordion - Editor Styles
 */

/* Main editor container */
.bw-advanced-tabordion-editor {
    background-color: #ffffff;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
}

/* Header section with title and add button */
.tabordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e2e4e7;
}

.tabordion-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* Tabs container - horizontal layout to match frontend */
.tabordion-tabs-container {
    display: flex;
    flex-direction: row;
    min-height: 400px;
    border: 1px solid #dddddd;
    border-radius: 4px;
    overflow: hidden;
}

/* Tabs list - vertical layout to match frontend */
.tabordion-tabs-list {
    display: flex;
    flex-direction: column;
    width: 25%;
    min-width: 200px;
    max-width: 300px;
    border-right: 1px solid #dddddd;
    background-color: #f7f7f7;
    overflow-y: auto;
    max-height: 600px;
}

/* Tab item - styled to match frontend */
.tabordion-tab-item {
    position: relative;
    border-bottom: 1px solid #dddddd;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 100%;
}

.tabordion-tab-item:last-child {
    border-bottom: none;
}

.tabordion-tab-item.active {
    background-color: #ffffff;
}

/* Tab title row */
.tab-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
}

.tab-title-input-wrap {
    flex: 1;
    margin-right: 10px;
}

.tab-title-input {
    font-size: 15px;
    font-weight: 500;
    width: 100%;
    min-width: 100px;
    outline: none;
    padding: 4px;
    transition: all 0.3s ease;
}

.tabordion-tab-item.active .tab-title-input {
    font-weight: 600;
}

/* Tab title actions - adjust positioning to be less obtrusive */
.tab-title-actions {
    display: flex;
    align-items: center;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.tabordion-tab-item:hover .tab-title-actions {
    opacity: 1;
}

.tab-title-actions button {
    padding: 4px !important;
    margin-left: 4px !important;
    min-width: 24px !important;
    height: 24px !important;
}

/* Tab content panel */
.tabordion-tab-content {
    background-color: #ffffff;
    padding: 25px;
    flex: 1;
    min-width: 65%;
    max-height: 600px;
    overflow-y: auto;
}

/* Tab panel editor */
.tab-panel-editor {
    display: flex;
    flex-direction: column;
}

.tab-content-editor {
    display: flex;
    flex-direction: column;
}

/* Tab settings panel */
.tab-settings-panel {
    background-color: #f9f9f9;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.tab-settings-panel h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

/* Editor content area */
.editor-content-area {
    margin-top: 10px;
}

.editor-content-area h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 14px;
    font-weight: 600;
}

/* Structured content editor - more compact */
.tab-structured-content {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    border: 1px solid #e0e0e0;
    background: white;
    padding: 12px;
    border-radius: 3px;
    max-height: 500px; /* Limit max height for large screens */
}

/* Column layout - more compact */
.tab-column {
    padding: 10px;
    border-radius: 3px;
    background-color: #f9f9f9;
}

.tab-column.left-column {
    flex: 6; /* 60% width */
}

.tab-column.right-column {
    flex: 4; /* 40% width */
    overflow-y: auto; /* Allow scrolling for content area */
}

/* Field styling - more compact */
.tab-content-field {
    margin-bottom: 12px;
}

.tab-content-field h5 {
    margin-top: 0;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #555;
}

.tab-content-field label {
    margin-bottom: 3px;
    display: block;
    font-size: 11px;
}

/* Background image */
.background-image-preview {
    margin-top: 10px;
}

.background-image-preview img {
    margin-bottom: 10px;
    border: 1px solid #ddd;
}

.select-background-image {
    margin-top: 10px !important;
}

/* Text input styling - simplified for editor */
.tab-subtitle-input,
.tab-heading-input,
.tab-paragraph-input {
    border: 1px solid #ddd;
    padding: 6px;
    background-color: white;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
    line-height: 1.4;
}

/* Slight variations */
.tab-subtitle-input {
    min-height: 20px;
}

.tab-heading-input {
    min-height: 24px;
    font-weight: 600;
}

.tab-paragraph-input {
    min-height: 80px;
}

/* Basic link styling in editor */
.tab-paragraph-input a {
    color: #2271b1;
    text-decoration: underline;
}

/* Simple focus state */
.tab-content-field .block-editor-rich-text__editable:focus {
    border-color: #2271b1;
    outline: none;
}

.tab-button-input {
    border: 1px solid #ddd;
    padding: 8px;
    background-color: white;
    color: #ff7760;
}

/* Icon input */
.icon-input {
    margin-bottom: 15px;
    padding: 10px;
    background-color: rgba(255,255,255,0.7);
    border-radius: 3px;
}

.icon-input p {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 12px;
}

.icon-image-preview {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.select-icon-image {
    margin-top: 5px !important;
}

/* Info field */
.tab-info-field {
    padding: 10px;
    background-color: #f0f7ff;
    border: 1px solid #dbeaff;
    border-radius: 4px;
}

.tab-editor-info {
    margin: 0;
    font-size: 12px;
    font-style: italic;
    color: #4a6785;
}

/* InnerBlocks area - keep for compatibility */
.editor-content-area .block-editor-inner-blocks {
    border: 1px dashed #ddd;
    padding: 15px;
    background-color: #fafafa;
}

/* Helper classes */
.hidden {
    display: none !important;
}

/* For parent tabs in the editor - to match frontend styling */
.tabordion-tab-item[data-tab-type="parent"] {
    position: relative;
}

.tabordion-tab-item[data-tab-type="parent"] .tab-title-input {
    font-weight: 600;
}

.tabordion-tab-item[data-tab-type="parent"]::after {
    content: "▾";
    position: absolute;
    right: 45px; /* Adjusted to avoid overlap with tab actions */
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 12px;
}

/* For child tabs in the editor - to match frontend styling */
.tabordion-tab-item[data-tab-type="child"] {
    position: relative;
    background-color: #f9f9f9;
}

.tabordion-tab-item[data-tab-type="child"] .tab-title-row {
    padding-left: 35px;
}

.tabordion-tab-item[data-tab-type="child"]::before {
    content: "›";
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 16px;
}

.tabordion-tab-item[data-tab-type="child"] .tab-title-input {
    font-size: 14px;
}

/* For placeholder tabs in the editor */
.tabordion-tab-item[data-tab-type="placeholder"] {
    opacity: 0.7;
}

.tabordion-tab-item[data-tab-type="placeholder"] .tab-title-input::after {
    content: "↗";
    margin-left: 5px;
    font-size: 80%;
}

/* Subtle hover effect on tabs */
.tabordion-tab-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Visual hierarchy for parent-child relationships */
.tabordion-tab-item[data-tab-type="parent"] + .tabordion-tab-item[data-tab-type="child"] {
    border-top-color: rgba(221, 221, 221, 0.5);
}

/* Improve settings panel appearance */
.tab-settings-panel {
    margin-top: 5px;
}

/* Improve the editor's visual representation of the tab structure */
.bw-advanced-tabordion-editor {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Make the edit experience more polished */
.editor-content-area .block-editor-inner-blocks:focus-within {
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
    outline: 2px solid transparent;
}