/* Menu Administration Styles */

.menu-hierarchy-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 1rem;
    min-height: 400px;
}

.menu-sortable {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-sortable .menu-sortable {
    margin-left: 20px;
    margin-top: 10px;
    padding-left: 15px;
    border-left: 2px solid #e9ecef;
}

.menu-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    margin-bottom: 8px;
    position: relative;
    transition: all 0.2s ease;
}

.menu-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.menu-item.ui-sortable-helper {
    background: #fff3cd;
    border-color: #ffc107;
    transform: rotate(2deg);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.menu-item-content {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    gap: 0.5rem;
}

.menu-handle {
    cursor: grab;
    color: #6c757d;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.menu-handle:hover {
    background: #e9ecef;
    color: #495057;
}

.menu-handle:active {
    cursor: grabbing;
}

.menu-icon {
    width: 24px;
    text-align: center;
    color: #007bff;
}

.menu-name {
    flex: 1;
    font-weight: 500;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.menu-name:hover {
    background: #e7f3ff;
    color: #0056b3;
}

.menu-link {
    font-size: 0.875rem;
    color: #6c757d;
    font-family: 'Monaco', 'Consolas', monospace;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid #e9ecef;
}

.menu-actions {
    display: flex;
    gap: 0.25rem;
}

.menu-actions .btn {
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

/* Level-specific styling */
.menu-item[data-level="1"] {
    border-left: 4px solid #007bff;
}

.menu-item[data-level="2"] {
    border-left: 4px solid #28a745;
}

.menu-item[data-level="3"] {
    border-left: 4px solid #ffc107;
}

.menu-item[data-level="4"] {
    border-left: 4px solid #dc3545;
}

/* Sortable placeholder */
.menu-sortable-placeholder {
    background: #e3f2fd;
    border: 2px dashed #2196f3;
    border-radius: 0.25rem;
    height: 50px;
    margin-bottom: 8px;
    position: relative;
}

.menu-sortable-placeholder:before {
    content: "Solte o item aqui";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #2196f3;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Icon preview in modal */
.icon-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.icon-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-item:hover {
    background: #e9ecef;
    border-color: #007bff;
    color: #007bff;
}

.icon-item i {
    width: 14px;
    text-align: center;
}

/* Form enhancements */
#icon-preview {
    transition: all 0.2s ease;
}

.input-group-text {
    min-width: 45px;
    justify-content: center;
}

/* Info box customization */
.info-box {
    border-radius: 0.375rem;
    overflow: hidden;
}

.info-box-content h5 {
    margin-bottom: 0.75rem;
    color: #495057;
}

.info-box-content ul li {
    padding: 0.25rem 0;
    font-size: 0.875rem;
}

.info-box-content ul li i {
    width: 20px;
    margin-right: 0.5rem;
}

/* Loading states */
.menu-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.menu-item.loading .menu-item-content:after {
    content: "";
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    border: 2px solid #dee2e6;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error states */
.menu-item.error {
    border-color: #dc3545;
    background: #f8d7da;
}

/* Success states */
.menu-item.success {
    border-color: #28a745;
    background: #d4edda;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .menu-item-content {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .menu-name {
        min-width: 100%;
        order: 1;
    }

    .menu-link {
        order: 2;
        font-size: 0.75rem;
    }

    .menu-actions {
        order: 3;
        margin-left: auto;
    }

    .menu-sortable .menu-sortable {
        margin-left: 10px;
        padding-left: 10px;
    }
}

/* Drag feedback */
.ui-sortable-helper {
    z-index: 1000 !important;
}

.ui-sortable-placeholder {
    visibility: visible !important;
}

/* Modal enhancements */
.modal-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.form-group label {
    font-weight: 500;
    color: #495057;
}

.select2-container--bootstrap4 .select2-selection {
    height: calc(2.25rem + 2px);
}

/* Validation styles */
.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-valid {
    border-color: #28a745;
}

.invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}