/**
 * SCHOOLSITE BUILDER - Menu Editor Styles
 */

/* Menu Editor Panel */
.menu-editor-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.menu-editor-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.menu-editor-header h3 {
    margin: 0 0 4px;
    font-size: 1.25rem;
    color: #1f2937;
}

.menu-editor-hint {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.menu-editor-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 1.25rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}

.menu-editor-close:hover {
    background: #e5e7eb;
    color: #1f2937;
}

.menu-editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

/* Menu Items List */
.menu-items-list {
    min-height: 100px;
}

.menu-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 0.9rem;
}

.menu-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.menu-item:hover {
    border-color: #d1d5db;
}

.menu-item.dragging {
    opacity: 0.5;
    border-color: #4f46e5;
}

.menu-item-drag {
    display: inline-block;
    cursor: grab;
    color: #9ca3af;
    margin-right: 8px;
    user-select: none;
}

.menu-item-drag:active {
    cursor: grabbing;
}

.menu-item-content {
    display: inline-flex;
    gap: 8px;
    flex: 1;
    vertical-align: middle;
}

.menu-item-text,
.menu-item-url {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.menu-item-text {
    width: 140px;
}

.menu-item-url {
    width: 180px;
    color: #6b7280;
}

.menu-item-text:focus,
.menu-item-url:focus {
    outline: none;
    border-color: #4f46e5;
}

.menu-item-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    vertical-align: middle;
    float: right;
}

.menu-item-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 6px 10px;
    background: #e5e7eb;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #6b7280;
    transition: all 0.2s;
}

.menu-item-dropdown-toggle:hover {
    background: #d1d5db;
}

.menu-item-dropdown-toggle input {
    display: none;
}

.menu-item-dropdown-toggle input:checked + .dropdown-icon {
    color: #4f46e5;
}

.dropdown-icon {
    font-size: 0.7rem;
}

.menu-item-delete {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.menu-item-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Dropdown Children */
.menu-item-children {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #d1d5db;
    margin-left: 24px;
}

.menu-subitem {
    background: #fff;
    margin-bottom: 6px;
    padding: 10px;
}

.menu-subitem .menu-item-content {
    display: flex;
}

.menu-subitem .menu-item-text {
    width: 120px;
}

.menu-subitem .menu-item-url {
    width: 150px;
}

.menu-add-subitem {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px dashed #d1d5db;
    background: transparent;
    border-radius: 6px;
    color: #6b7280;
    font-size: 0.85rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}

.menu-add-subitem:hover {
    border-color: #4f46e5;
    color: #4f46e5;
}

/* Add Buttons */
.menu-add-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.menu-add-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px dashed #d1d5db;
    background: transparent;
    border-radius: 8px;
    color: #6b7280;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-add-btn:hover {
    border-color: #4f46e5;
    color: #4f46e5;
    background: #f5f3ff;
}

.menu-add-icon {
    width: 24px;
    height: 24px;
    background: #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.2s;
}

.menu-add-btn:hover .menu-add-icon {
    background: #4f46e5;
    color: #fff;
}

/* Style Section */
.menu-editor-style {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.menu-editor-style h4 {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: #374151;
}

.menu-style-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.menu-style-row:last-child {
    margin-bottom: 0;
}

.menu-style-row label {
    width: 100px;
    font-size: 0.85rem;
    color: #6b7280;
}

.menu-style-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Footer */
.menu-editor-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================
   RENDERED MENU IN EDITOR
   ============================================ */

.site-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
}

.site-menu.menu-align-left {
    justify-content: flex-start;
}

.site-menu.menu-align-center {
    justify-content: center;
}

.site-menu.menu-align-right {
    justify-content: flex-end;
}

.menu-item-wrapper {
    position: relative;
}

.menu-link {
    display: inline-block;
    padding: 8px 16px;
    text-decoration: none;
    color: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    border-radius: 4px;
}

.menu-link:hover {
    opacity: 0.8;
}

/* Text style */
.menu-link.menu-style-text {
    background: transparent;
    padding: 8px 12px;
}

.menu-link.menu-style-text:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Button style */
.menu-link.menu-style-button {
    background: var(--button-color, #4f46e5);
    color: #fff;
    border-radius: 6px;
}

.menu-link.menu-style-button:hover {
    opacity: 0.9;
}

/* Pill style */
.menu-link.menu-style-pill {
    background: var(--button-color, #4f46e5);
    color: #fff;
    border-radius: 50px;
}

.menu-dropdown-arrow {
    font-size: 0.7rem;
    margin-left: 4px;
    opacity: 0.7;
}

/* Dropdown Menu */
.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 100;
}

.menu-has-dropdown:hover .menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-dropdown-item {
    display: block;
    padding: 10px 16px;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.menu-dropdown-item:hover {
    background: #f3f4f6;
}

/* Edit Button */
.menu-edit-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 6px;
    cursor: pointer;
    color: #4f46e5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    opacity: 0;
    transition: all 0.2s;
}

.site-menu:hover .menu-edit-btn,
.block-wrapper:hover .menu-edit-btn {
    opacity: 1;
}

.menu-edit-btn:hover {
    background: #4f46e5;
    color: #fff;
}

/* Overlay when menu editor is open */
.menu-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}
